iOS 笔记-AFN使用中的遇到的问题

今天使用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];

由此便解决问题了~

 

转载于:https://www.cnblogs.com/ruixin2222/p/5045236.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值