Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@k0sukey
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k0sukey/5e49fb83bdfb07b691ea to your computer and use it in GitHub Desktop.
Save k0sukey/5e49fb83bdfb07b691ea to your computer and use it in GitHub Desktop.
Extension, pick up the Ti.Network.HTTPClient 401 response on async
// 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