标签:
今天使用AFN做注册时,控制台输出如下
Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/plain" UserInfo=0x16d6ccc0 {com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x16ef0620> { URL: http://192.168.1.60:8078/video/common/appvideo!register.erun } { status code: 200, headers {
"Content-Length" = 109;
"Content-Type" = "text/plain;charset=UTF-8";
Date = "Mon, 14 Dec 2015 03:13:09 GMT";
Server = "Apache-Coyote/1.1";
} }, NSErrorFailingURLKey=http://192.168.1.60:8078/video/common/appvideo!register.erun, NSLocalizedDescription=Request failed: unacceptable content-type: text/plain, com.alamofire.serialization.response.error.data=<7b227265 73756c74 223a22e6 b3a8e586 8ce5a4b1 e8b4a52c e6898be6 9cbae58f b7e7a081 e5b7b2e7 bb8fe6b3 a8e5868c 2ce8afb7 e69bb4e6 8da2e689 8be69cba e58fb7ef bc81222c 226d7367 223a22e6 b3a8e586 8ce5a4b1 e8b4a522 2c227375 63636573 73223a66 616c7365 7d>}
重点在红色那句,经查证得知是AFN中的问题,需修改三方库中
AFURLResponseSerialization.m文件223行,
self.acceptableContentTypes = [NSSetsetWithObjects:@"application/json", @"text/plain",@"text/json",@"text/javascript", nil];
由此便解决问题了~
标签:
原文地址:http://www.cnblogs.com/ruixin2222/p/5045236.html