iOS url
来源:互联网 发布:生鲜配送软件 编辑:程序博客网 时间:2024/05/23 15:44
An NSURL object represents a URL that can potentially contain the location of a resource on a remote server, the path of a local file on disk, or even an arbitrary piece of encoded data. 指明获取数据的对象 网站地址 或者文件地址等
NSURLRequest objects represent a URL load request in a manner independent of protocol and URL scheme.创建一个请求,可以指定缓存策略以及超时时间。
The NSURLConnection
class provides convenience class methods to load URL requests both asynchronously using a callback block and synchronously.连接成功则返回数据
-
start:开始下载。默认初始化设定了delegate后便自动开始,但如果没有设定则可以调用此开始 - cancel:在一次请求开始到结束之间调用cancel,会结束当前的请求,并不再接受消息。
- connection :didReceiveResponse:当接受了足够创建NSURLResponse对象的数据后会调用。
- connection:didReceiveData:下载开始后,每当有数据包,都会定期的调用此方法,我们应该在该方法里存储接受到的数据。
- connection:didFailWithError:下载过程中有异常,返回失败信息后便不再接收数据
- connectionDidFinishLoadi
ng:下载顺利完成。
For greater control, you can create a URL connection object with a delegate object that conforms to the NSURLConnectionDelegate
andNSURLConnectionDataDelegate
protocols. The connection calls methods on that delegate to provide you with progress and status as the URL request is loaded asynchronously. The connection also calls delegate methods to let you override the connection’s default behavior (for example, specifying how a particular redirect should be handled). These delegate methods are called on the thread that initiated the asynchronous load operation.
NSJSONSerialization
NSJSONReadingOptions
Options used when creating Foundation objects from JSON data—see JSONObjectWithData:options:error:
and JSONObjectWithStream:options:error:
.
enum { NSJSONReadingMutableContainers = (1UL << 0), NSJSONReadingMutableLeaves = (1UL << 1), NSJSONReadingAllowFragments = (1UL << 2)};typedef NSUInteger NSJSONReadingOptions;
Constants
NSJSONReadingMutableContainers
Specifies that arrays and dictionaries are created as mutable objects.// 应该是最灵活的 所有对象都可以
Available in iOS 5.0 and later.
Declared in
NSJSONSerialization.h
.NSJSONReadingMutableLeaves
Specifies that leaf strings in the JSON object graph are created as instances of
NSMutableString
.//可变字符串对象Available in iOS 5.0 and later.
Declared in
NSJSONSerialization.h
.NSJSONReadingAllowFragments
Specifies that the parser should allow top-level objects that are not an instance of
NSArray
orNSDictionary
.//不能是不可变的对象Available in iOS 5.0 and later.
Declared in
NSJSONSerialization.h
.
- iOS url
- URL for iOS developing
- ios URL Scheme
- IOS url encode
- iOS 中的Url 编码
- ios Url Encode
- iOS跳转url
- iOS URL schemes 查看
- IOS URL 转义方法
- ios url转义
- iOS notes about url
- ios URL Scheme
- IOS URL解码,编码
- iOS url 编码 解码
- ios 常用 url scheme
- ios的URL Scheme
- iOS URL schemes
- iOS URL Loading System
- codeforce 34B
- Java并发器分析
- java读取中文分词工具(四)
- 什么时间段里做汗蒸最合适
- leetcode Binary Tree Postorder Traversal
- iOS url
- hdu 4902 Nice boat(线段树区间修改,输出最终序列)
- android基础笔记:从网路中读取数据,并显示(Thread、handler、httpclient、XmlPullParser 、BaseAdapter)
- Qt之QMovie 在标签上做出一个动画
- 判断是否是手机访问
- android UI进阶之实现listview的下拉刷新和加载
- 《C Primer Plus》 学习笔记系列之(三)
- 复制Simulink中的仿真模型到word中形成矢量图的方法(图像很清楚)
- MongoDB命令及SQL语法对比