Skip to content

Instantly share code, notes, and snippets.

@sanketfirodiya
Created November 11, 2014 20:46
Show Gist options
  • Save sanketfirodiya/67684baaab45b164d66c to your computer and use it in GitHub Desktop.
Save sanketfirodiya/67684baaab45b164d66c to your computer and use it in GitHub Desktop.
NSURLSession Sample
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithURL:[NSURL URLWithString:@"https://itunes.apple.com/search?term=apple&media=software"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@", json);
}];
[dataTask resume];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment