Reputation: 21436
I installed AFNetworking via CocoaPods:
pod "AFNetworking", '~> 2.0.3'
So, the method, which called from standart GET request:
- (NSURLSessionDataTask *)GET:(NSString *)URLString
parameters:(NSDictionary *)parameters
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure
calls - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request;
that returns nil
on iOS 6.
Because AFNetworking uses NSURLSessionTask
& NSURLSession
which is introduced in iOS 7.0
And from AFNetworking Documentation:
New Requirements: iOS 6, Mac OS X 10.8, & Xcode 5
AFNetworking 2.0 officially supports iOS 6+, Mac OS X 10.8+, and Xcode 5.
Why it calls methods, that appears only in iOS7?
Upvotes: 2
Views: 1291
Reputation: 21436
I found solution:
My API client inherit from AFHTTPSessionManager
(like in afnetwoking site example).
But if you are using iOS 6 just leave inheritance from AFHTTPRequestOperationManager
like in AFNetworking 1.x versions.
Replace:
@interface APIClient : AFHTTPSessionManager
to:
@interface APIClient : AFHTTPRequestOperationManager
Upvotes: 2