Search code examples
ios6afnetworking-2

Download file using AFNetworking on iOS 6


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


Solution

  • 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).