与 NSURLConnection 委托方法相关的查询

发布于 2024-12-07 15:18:09 字数 685 浏览 1 评论 0原文

我正在开发一个 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) 当我们调用 [; cancel],请求是立即取消还是当请求实际取消时我们会得到任何回调吗?调用取消后立即释放 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

櫻之舞 2024-12-14 15:18:09

我认为他们应该为我工作并且工作得很好。即使它们的注释就像您在 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 in NSURLConnection doc. So I hope they should work. I am saying this because they are working for me in IOS 5.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文