Skip to content

Instantly share code, notes, and snippets.

@wilsolutions
Created October 22, 2011 16:25
Show Gist options
  • Save wilsolutions/1306164 to your computer and use it in GitHub Desktop.
Save wilsolutions/1306164 to your computer and use it in GitHub Desktop.
JSON NSLOG output
- (void)viewDidLoad
{
NSError *error = nil;
// Prepare URL request to JSON call...
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:
@"http://reviewapp/items.json"]];
NSData *response = [NSURLConnection
sendSynchronousRequest:request
returningResponse:nil error:nil];
// Get JSON as a NSString from NSData response
NSString *json_string = [[NSString alloc]initWithData:response encoding:NSUTF8StringEncoding];
// output my JSON response?
NSLog(@"JSON: %@", json_string);
[super viewDidLoad];
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment