Skip to content

Instantly share code, notes, and snippets.

@command-tab
Created October 31, 2012 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save command-tab/3989242 to your computer and use it in GitHub Desktop.
Save command-tab/3989242 to your computer and use it in GitHub Desktop.
#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