在iOS 6上使用AFNetworking下载文件 [英] Download file using AFNetworking on iOS 6
问题描述
我最近更新了AFNetworking 2.0。该文档称它与iOS6.0 +兼容。当我尝试实现下载方法(图像和视频)时,我正在构建iOS 6.0应用程序。示例使用
I've recently updated to AFNetworking 2.0. The documentation said it is compatible with iOS6.0+. I am building a iOS 6.0 app, when I am trying to implement a download method (both images and videos). The example use
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
然而,我得到了使用未声明的标识符'AFURLSessionManager'错误。我发现AFURLSessionManager使用的是只能从iOS7获得的类。我只是想知道,我可以使用AFNetworking在iOS6下载谁?
However, I got an "Use of undeclared identifier 'AFURLSessionManager'" error. And I found out that AFURLSessionManager use a class that is only available from iOS7. I'm just wondering, who could I download in iOS6 using AFNetworking?
另外,有没有看到下载进度?
Also, is there anyway to see download progress?
谢谢
推荐答案
如你所说 AFURLSessionManager
仅适用于iOS 7(由支持) NSURLSession
),因此您应该在AFNetworking 2.0中使用基于 NSURLConnection
的类( AFHTTPRequestOperationManager
, AFHTTPRequestOperation
等)。
As you say AFURLSessionManager
is only available in iOS 7(is backed by NSURLSession
), so you should use the NSURLConnection
based classes in AFNetworking 2.0 (AFHTTPRequestOperationManager
, AFHTTPRequestOperation
, etc).
这篇关于在iOS 6上使用AFNetworking下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!