Created
September 30, 2009 23:21
-
-
Save chrisabruce/198556 to your computer and use it in GitHub Desktop.
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
- (void)connectionDidFinishLoading:(NSURLConnection *)connection { | |
[connection release]; | |
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; | |
[responseData release]; | |
//NSLog(responseString); | |
NSError *error; | |
SBJSON *json = [[SBJSON new] autorelease]; | |
NSDictionary *feedData = [json objectWithString:responseString error:&error]; | |
[responseString release]; | |
//NSLog([feedData description]); | |
if (feedData == nil) | |
label.text = [NSString stringWithFormat:@"JSON Parsing failed: %@", [error localizedDescription]]; | |
else { | |
NSArray *feedItems = [feedData objectForKey:@"game_session"]; | |
NSMutableString *text = [[NSMutableString alloc] init]; | |
for (int i = 0; i < [feedItems count]; i++) { | |
NSDictionary *item = [feedItems objectAtIndex:i]; | |
[text appendFormat:@"%@ played %@\n", [item objectForKey:@"gamername"], [item objectForKey:@"game_name"]]; | |
} | |
label.text = text; | |
[text release]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment