Last active
October 7, 2017 20:05
-
-
Save baarde/46f3c9cb3c56927b1356 to your computer and use it in GitHub Desktop.
How to use AFNetworking synchronously
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 "AFNetworking.h" | |
int main(void) | |
{ | |
NSURL *baseURL = [NSURL URLWithString:@"http://graph.facebook.com/"]; | |
AFHTTPRequestOperationManager *operationManager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:baseURL]; | |
AFHTTPRequestOperation *operation = [operationManager GET:@"Octiplex" parameters:nil success:nil failure:nil]; | |
[operationManager.operationQueue waitUntilAllOperationsAreFinished]; | |
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate date]]; // Executes async notification blocks waiting in the main queue | |
NSLog(@"Response: %@", operation.responseObject); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment