Created
October 31, 2012 19:22
-
-
Save command-tab/3989242 to your computer and use it in GitHub Desktop.
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
#import <Foundation/Foundation.h> | |
#import "AFNetworking.h" | |
int main(int argc, const char *argv[]) | |
{ | |
@autoreleasepool { | |
NSURL *url = [NSURL URLWithString:@"https://api.github.com/users/AFNetworking/repos"]; | |
NSURLRequest *request = [NSURLRequest requestWithURL:url]; | |
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { | |
NSLog(@"success: %@", JSON); | |
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) { | |
NSLog(@"failure with error: %@", [error localizedDescription]); | |
}]; | |
[operation start]; | |
[operation waitUntilFinished]; | |
NSLog(@"Done"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment