Skip to content

Instantly share code, notes, and snippets.

@armadsen
Last active August 29, 2015 14:16
Show Gist options
  • Save armadsen/92b90d76e88921a71607 to your computer and use it in GitHub Desktop.
Save armadsen/92b90d76e88921a71607 to your computer and use it in GitHub Desktop.
DevMountain Lesson 17 (Submodules, AVFoundation, CocoaPods) copy/paste blocks
git submodule add https://github.com/AFNetworking/AFNetworking.git External/AFNetworking
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.timeapi.org/utc/now"]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.responseSerializer = [AFHTTPResponseSerializer serializer];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, NSData *responseObject) {
NSString *response = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
NSLog(@"response: %@", response);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error: %@", error);
}];
[operation start];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment