Created
June 13, 2014 22:38
-
-
Save pwgustafson/05c1da97ae77e7ec9fe3 to your computer and use it in GitHub Desktop.
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
//NSString *string = [NSString stringWithFormat:@"%@weather.php?format=json", BaseURLString]; | |
NSString *string = [NSString stringWithFormat:@"%@sessions", BaseURLString]; | |
NSURL *url = [NSURL URLWithString:string]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:url]; | |
// 2 | |
NSDictionary *params = @{@"email": email, | |
@"password": password}; | |
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; | |
operation.responseSerializer = [AFJSONResponseSerializer serializer]; | |
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { | |
// 3 | |
//self.weather = (NSDictionary *)responseObject; | |
//self.title = @"JSON Retrieved"; | |
//[self.tableView reloadData]; | |
NSLog(@"%@", responseObject); | |
//[self popViewControllerAnimated:YES]; | |
[self.navigationController popViewControllerAnimated:YES]; | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
// 4 | |
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error Retrieving Weather" | |
message:[error localizedDescription] | |
delegate:nil | |
cancelButtonTitle:@"Ok" | |
otherButtonTitles:nil]; | |
[alertView show]; | |
}]; | |
// 5 | |
[operation start]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment