Created
September 11, 2015 18:25
-
-
Save mluton/b0483e09b3cb48e3f54e to your computer and use it in GitHub Desktop.
Simple JSON URL Request
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
NSURLSession *session = [NSURLSession sharedSession]; | |
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.example.com/endpoint_%@.json", parameter]]; | |
NSURLSessionDataTask *dataTask = [session dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | |
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; | |
}]; | |
[dataTask resume]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment