Created
February 9, 2013 08:58
-
-
Save nicklockwood/4744639 to your computer and use it in GitHub Desktop.
Async networking on iOS
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
NSURLrequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com/file.json"]]; | |
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) { | |
id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL]; | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment