Skip to content

Commit

Permalink
Added special handling for unauthorized access (401).
Browse files Browse the repository at this point in the history
  • Loading branch information
rokgregoric committed Apr 5, 2013
1 parent d79ab73 commit b99d567
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion RGNetworking.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ + (void)asyncURLRequest:(NSMutableURLRequest *)request withCompletion:(void (^)(
NSHTTPURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if (error) {
NSLog(@"RGNetworking error: %@", error);
if (error.code == -1012) {
response = [[NSHTTPURLResponse alloc] initWithURL:nil statusCode:401 HTTPVersion:nil headerFields:nil];
data = nil;
} else {
NSLog(@"RGNetworking error: %@", error);
}
}
runInForeground(^{
UIApplication.sharedApplication.networkActivityIndicatorVisibleWithCounter = NO;
Expand Down

0 comments on commit b99d567

Please sign in to comment.