Skip to content

Instantly share code, notes, and snippets.

@jlee42
Created December 6, 2012 21:12
Show Gist options
  • Save jlee42/4228465 to your computer and use it in GitHub Desktop.
Save jlee42/4228465 to your computer and use it in GitHub Desktop.
[[RKObjectManager sharedManager].HTTPClient postPath:@"/api/v2/json/api_users/sign_in" parameters:params success:^(AFHTTPRequestOperation *operation, id JSON)
{
// Success
NSLog(@"Success");
NSString *auth_token = [JSON class];
NSLog(@"AUTH_TOKEN: %@", auth_token);
} failure:^(AFHTTPRequestOperation *operation, NSError *error)
{
// Error
if ([operation.response statusCode] == 401) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Failure"
message:@"Failed"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment