标签:
1.访问网络获取Json
//Get方法
NSString *str = @"http://api.xxx.cc/product/found.jhtml";
NSDictionary *params = [[NSDictionary alloc] initWithObjectsAndKeys:@"18678956721",@"phone",@"123123",@"password",nil]; //参数列表
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"]; //报错的话修改此处,根据错误返回信息设置具体的内容
[manager GET:str parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { //GET/POST
NSLog(@"JSON: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];
标签:
原文地址:http://www.cnblogs.com/punkrocker/p/4409462.html