码迷,mamicode.com
首页 > 移动开发 > 详细

IOS AFNetworking2.0 问题

时间:2014-12-09 19:40:37      阅读:353      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   io   ar   color   os   sp   

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, 所以无须再解析

bubuko.com,布布扣




IOS AFNetworking2.0 问题

标签:des   style   blog   http   io   ar   color   os   sp   

原文地址:http://blog.csdn.net/alincexiaohao/article/details/41826359

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!