Skip to content

Instantly share code, notes, and snippets.

@kylefox
Created March 10, 2012 22:19
Show Gist options
  • Save kylefox/2013602 to your computer and use it in GitHub Desktop.
Save kylefox/2013602 to your computer and use it in GitHub Desktop.
-(void)realAuthenticate {
NSURLRequest *request = [self getURLRequest];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request
success:^( NSURLRequest *request , NSHTTPURLResponse *response , id JSON ) {
NSString *domain = [[(NSArray *)[JSON objectForKey:@"sites"] lastObject] objectForKey:@"domain"];
Portfolio *portfolio = [[Portfolio alloc] init];
portfolio.domain = domain;
self.portfolio = portfolio;
[self finishAuth:YES];
}
failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
[self finishAuth:NO];
}];
[operation start];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment