Last active
March 30, 2016 19:58
-
-
Save DonMag/276067ad23f7542c11ff981446bde2c5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| - (IBAction)runTestURL:(id)sender { | |
| // 1 | |
| NSString *dataUrl = @"https://someurl.com"; | |
| NSURL *url = [NSURL URLWithString:dataUrl]; | |
| // 2 | |
| NSURLSessionDataTask *downloadTask = [[NSURLSession sharedSession] dataTaskWithURL:url | |
| completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | |
| // 4: Handle response here | |
| NSString *s = = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | |
| }]; | |
| // 3 | |
| [downloadTask resume]; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment