failure:^(NSURLSessionDataTask *task, NSError *error) {
// responseString or responseObject?
}]
The responseObject should be something like NSData or JSON object based on responseSerializer you are using. However, nothing would actually returns if your request failed. Thus you cannot cate responseObject in failure handler.
This problem has been solved:
failure:^(NSURLSessionDataTask *task, NSError *error) {
NSData *responseData = (NSData *)error.userInfo[AFNetworkingOperationFailingURLResponseDataErrorKey];
}]
If you want the raw data, you can use AFNetworkingOperationFailingURLResponseDataErrorKey as above.
Most helpful comment
If you want the raw data, you can use
AFNetworkingOperationFailingURLResponseDataErrorKeyas above.