IOS 网络连接相关资源

IOS参考官方文档:

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html

 

如果你想下载URL所制定的内容,必须要要实现这个协议:NSURLConnectionDelegate 其中的几个方法:

 

In order to download the contents of a URL, an application needs to provide a  delegate   object that, at a minimum, implements the following delegate methods: 


connection:didReceiveResponse:

connection:didReceiveData:

connection:didFailWithError:

connectionDidFinishLoading:

 

1:如果执行了:connection:didFailWithError: 消息,那么从NSError可以提取: [error code] 和 [error userInfo](返回一个字典)

我们可以从字典中抽取出:NSURLErrorFailingURLStringErrorKey 所对应的消息:

NSString object for the URL which caused a load to fail

如果执行这个消息的话,其他的代理方法将不会再执行!

it receives no further delegate messages for the specified connection.

 

相关概念:

服务器端验证:

NSURLCredentialStorage

 

continueWithoutCredentialForAuthenticationChallenge(消息)

 

  sendSynchronousRequest:returningResponse:error:(发送同步请求)

 

 

疑问:

1:同步发送请求和异步发送请求在IOS中有什么差别呢?

2:如何创建认证证书或者认证凭证呢?

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值