标签:http io ar os sp on log bs cti
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
// 设置URL
[request setURL:[NSURL URLWithString:@"http://www.baidu.com"]]; //请求服务器的API地址
// 设置HTTP方法
[request setHTTPMethod:@"GET"];
NSData *returnData = [NSURLConnection sendSynchronousRequest:request
returningResponse:nil error:nil];
NSLog(@"%@",returnData);
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:returnData options:0 error:nil];
NSLog(@"%@",dict);
标签:http io ar os sp on log bs cti
原文地址:http://www.cnblogs.com/i0ject/p/4128594.html