Detect Time Out Error With AFNetworking Detect Time Out Error With AFNetworking objective-c objective-c

Detect Time Out Error With AFNetworking


Since AFNetworking is build on top on NSULConnection/NSULRSession you can just NSURLErrorTimedOut to check if the error is a timeout error:

 failure:^(AFHTTPRequestOperation *operation, NSError *error) {    if (error.code == NSURLErrorTimedOut) {      //time out error here    }}];

You where checking the HTTP status code, but since the connection timed out there is not statuscode.