AFNetWorking Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: una

原文链接:http://www.chenruixuan.com/archives/1078.html

以下是在是用AFNet过程中遇到的错误
错误提示: Error Domain=com.alamofire.error.serialization.response Code=-1016 “Request failed: unacceptable content-type: text/html”

解决办法:在AF的源文件AFURLResponseSerialization.m中修改代码文件223行处

self.acceptableContentTypes = 
[NSSet setWithObjects:@"application/json", 
@"text/json", @"text/javascript", nil];

为:

self.acceptableContentTypes = 
[NSSet setWithObjects:@"application/json",
 @"text/json", @"text/javascript",@"text/html", nil];

你可能感兴趣的:(text-html,AFNet,Code--1016)