Last active
August 29, 2015 14:14
-
-
Save k0sukey/5e49fb83bdfb07b691ea to your computer and use it in GitHub Desktop.
Extension, pick up the Ti.Network.HTTPClient 401 response on async
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/3912532/ios-how-can-i-receive-http-401-instead-of-1012-nsurlerrorusercancelledauthenti | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation" | |
-(NSNumber*)status | |
{ | |
NSString *strError = [NSString stringWithFormat:@"%@", [[[self response] error] description]]; | |
if ([strError rangeOfString:@"Code=-1012"].location != NSNotFound) | |
{ | |
return NUMINTEGER(401); | |
} | |
else | |
{ | |
return NUMINTEGER([[self response] status]); | |
} | |
} | |
#pragma clang diagnostic pop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment