标签:
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; //申明返回的结果是json类型 manager.responseSerializer = [AFJSONResponseSerializer serializer]; //申明请求的数据是json类型 manager.requestSerializer=[AFJSONRequestSerializer serializer]; //如果报接受类型不一致请替换一致text/html或别的 manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; //传入的参数 NSDictionary *parameters = @{@"1":@"XXXX",@"2":@"XXXX",@"3":@"XXXXX"}; //你的接口地址 NSString *url=@"http://xxxxx"; //发送请求 [manager POST:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@"JSON: %@", responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"Error: %@", error); }];
标签:
原文地址:http://my.oschina.net/zdiovo/blog/419379