Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html"

使用AFNetworking时遇到这情况

Error Domain=com.alamofire.error.serialization.response Code=-1016


解决方法:

在AFNetworking的源文件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];

你可能感兴趣的:(Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html")