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];
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?
Thank you
try this...
You can use the
AFHTTPRequestOperation
class to perform a file download on iOS 6. You basically just need to set the operation'soutputStream
property to store the file and thedownloadProgressBlock
property to monitor the progress.The bare bones method below is declared in a class that is a subclass of
AFHTTPRequestOperationManager
. When I initialized an instance of this class I set up thebaseURL
property.As you say
AFURLSessionManager
is only available in iOS 7(is backed byNSURLSession
), so you should use theNSURLConnection
based classes in AFNetworking 2.0 (AFHTTPRequestOperationManager
,AFHTTPRequestOperation
, etc).