首页 > 技术文章 > AFNetworking 2.0 获取json数据时,返回 NSLocalizedDescription=Request failed: unacceptable content-type: text/html, 解决方法.

willbin 2014-08-27 10:36 原文

 

 

 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

 manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];

    

 

1:优先让服务器做好返回类型适配

 

2:服务器不做的话, 在程序中再加上上面的代码. 把类型加上.

推荐阅读