Created
November 5, 2014 04:05
-
-
Save edwardinubuntu/5778172308a0126b589a to your computer and use it in GitHub Desktop.
Parsing open gov data from array
This file contains 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
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { | |
if (!connectionError) { | |
NSError *error = nil; | |
NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error]; | |
if (!error) { | |
for (NSDictionary *eachPark in jsonArray) { | |
NSString *title = [eachPark objectForKey:@"stitle"]; | |
NSString *body = [eachPark objectForKey:@"xbody"]; | |
NSLog(@"Park info: %@, %@", title, body); | |
} | |
} else { | |
NSLog(@"Error with: %@", error); | |
} | |
} else { | |
NSLog(@"Connection with: %@", connectionError); | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment