标签:style blog http io color ar os 使用 sp
AFNetworking的出现:MAC/iOS设计的一套网络框架.(为了简化网络操作)
二、AFNetworking的使用
AFN进行GET、POST请求:
1 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; 2 manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; 3 [manager GET:@"http://www.weather.com.cn/data/sk/101010100.html" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { 4 NSLog(@"JSON: %@", responseObject); 5 } failure:^(AFHTTPRequestOperation *operation, NSError *error) { 6 NSLog(@"Error: %@", error); 7 }];
结果为:
2014-11-05 17:08:26.219 TestAFNetWorking[27957:70b] JSON: {
weatherinfo = {
Radar = "JC_RADAR_AZ9010_JB";
SD = "20%";
WD = "\U897f\U5357\U98ce";
WS = "2\U7ea7";
WSE = 2;
city = "\U5317\U4eac";
cityid = 101010100;
isRadar = 1;
njd = "\U6682\U65e0\U5b9e\U51b5";
qy = 1014;
temp = 17;
time = "16:45";
};
}
标签:style blog http io color ar os 使用 sp
原文地址:http://www.cnblogs.com/guchengfengyun/p/4076871.html