IOS AFNetworking2.0 问题

1、Error Domain=AFNetworkingErrorDomain Code=-1011 "Request failed: not found (404)" UserInfo=0x86811c0 {NSErrorFailingURLKey=http://192.168.6.77:8080/demo/rest/demo/getApplicationList, NSLocalizedDescription=Request failed: not found (404), NSUnderlyingError=0x8843ce0 "Request failed: unacceptable content-type: text/html", AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0x8844bd0>}

AFNetworking 2.0 默认不支持text/html
AFURLResponseSerialization.m  ->   self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil]; 添加 @"text/html" .

请求头到错误,    self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",@"text/plain", nil];  4楼已经解决了,把@"text/html" 添加到这里面就行,
或者写代码
//初始化manage
        manager = [AFHTTPRequestOperationManager manager];
//设置请求头contenttypes信息
        manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];
也是可以到
2、 -[__NSCFDictionary bytes]: unrecognized 看下面的responObject 已经是NSDictionary, 所以无须再解析





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值