AFN请求{ Status Code: 406, Headers { "Content-Language" = (en); "Content-Length" = (1175); "Content-Type" = ("text/html;charset=utf-8"); Date = ("Tue, 14 Nov 2017 02:49:51 GMT"); } }}

//404,406除了参数,路径错了,有可能都是需要使用multipart/form-data格式提交

{ Status Code: 406, Headers { 

"Content-Language" =    (en);

"Content-Length" =    (1175);

"Content-Type" =    ("text/html;charset=utf-8");

Date =    ("Tue, 14 Nov 2017 02:49:51 GMT");

} }}

因为做测试以下是直接写死的参数和路径

NSString *boundary = @"wfWiEWrgEFA9A78512weF7106A";

NSString *str = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];

[manager1.requestSerializer setValue:str forHTTPHeaderField:@"Content-Type"];

manager1.responseSerializer.acceptableContentTypes  = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil];

[manager1 POST:@"https://117.48.205.100:443/plant/mob/user/register" parameters:reqParams progress:^(NSProgress * _Nonnull downloadProgress) {

} success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {

NSString *unicodeStr = [NSString stringWithCString:[[responseObject objectForKey:@"msg"] UTF8String] encoding:NSUTF8StringEncoding];

NSLog(@"responseObject====%@====%@",responseObject,unicodeStr);

} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {

NSLog(@"%@",error);

}];

注:不喜勿喷!!!

你可能感兴趣的:(AFN请求{ Status Code: 406, Headers { "Content-Language" = (en); "Content-Length" = (1175); "Content-Type" = ("text/html;charset=utf-8"); Date = ("Tue, 14 Nov 2017 02:49:51 GMT"); } }})