#import <Foundation/Foundation.h>
#import "AFHTTPRequestOperationManager.h"
int main(int argc, const char * argv[])
{
@
autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
__block BOOL flag = YES;
[manager GET:@"
http://www.baidu.com/"
parameters:nil
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON: %@", responseObject);
flag = NO;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
flag = NO;
}];
while (flag)
{
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
}
}
return 0;
}
这样呢?