用AFNetworking postJSON数据的时候,刚开始提示我//Error Domain=NSURLErrorDomain Code=-1007 "too many HTTP redirects",说是多重定向问题
后来我改了之后又报错//NSLocalizedDescription=Expected status code in (200-299), got 400
解决办法:
NSString *pathStr=@"http://api.XXX.com/provider" ;
NSDictionary *jsonObject = @{@"key":@"d85c713ef6704d651c7ce",@"userId":@"123456654321"};
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:pathStr]];
httpClient.parameterEncoding=AFJSONParameterEncoding;
[httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]];
[httpClient setDefaultHeader:@"Accept" value:@"application/json"];
// NSMutableDictionary *params=[[NSMutableDictio