与 NSURLConnection 委托方法相关的查询
我正在开发一个 iPhone 应用程序,它使用 NSURLConnection 来获取一些网络内容。我的 iPhone 应用程序应在 iOS >= 4.1 上运行
(1) 以下委托方法在所有 iOS >= 4.1(包括 iOS5(Beta))中是否可用。
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;
文档提到这些方法“在 iOS 2.0 到 iOS 4.3 中可用”,并列在 iOS5 文档的“已弃用的 NSURLConnection 方法”部分下。 (但是,当我命令+单击这些方法时,它们列在 iOS5.0 库的基础框架下)
(2) 当我们调用 [
,请求是立即取消还是当请求实际取消时我们会得到任何回调吗?调用取消后立即释放 NSURLConnection_object 是否安全?
I am developing an iPhone application that uses NSURLConnection for fetching some network content. My iPhone application should work on iOS >= 4.1
(1) Are the following delegate methods available in all the iOS >= 4.1 including iOS5 (Beta).
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error;
The documentation mentions that these methods are 'Available in iOS 2.0 through iOS 4.3' and are listed under the section 'Deprecated NSURLConnection methods' of iOS5 documentation. (However when I command+Click on these methods, are listed under Foundation framework of iOS5.0 Library)
(2) When we call [<NSURLConnection_object> cancel]
, is the request cancelled immediately OR do we get any callbacks when the request is actually cancelled? Is it safe to release NSURLConnection_object immediately after the call to cancel?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为他们应该为我工作并且工作得很好。即使它们的注释就像您在
NSURLConnectionDelegate
中所说的那样,它们在NSURLConnection
文档中看起来也很好。所以我希望他们能够发挥作用。我这样说是因为他们在 IOS 5 中为我工作。I think they should work and working fine for me. Even they are commented like you said in
NSURLConnectionDelegate
, they are looking fine inNSURLConnection
doc. So I hope they should work. I am saying this because they are working for me in IOS 5.