iOS 请求网络遇到 NSLocalizedDescription = "Request failed: unacceptable content-type: text/json"
iOS 请求网络遇到: NSLocalizedDescription = “Request failed: unacceptable content-type: text/json”
NSErrorFailingURLKey = “https://nbapi.ky-express.com/kyeapi/TenderJudgeForRelease“;
NSLocalizedDescription = “Request failed: unacceptable content-type: text/json”;
原因:
不可接受的内容类型 “text/html”
解决方案:
AFURLResponseSerialization.m中,228行左右
把 这句: self.acceptableContentTypes = [NSSet setWithObjects:@”application/json”, @”text/json”, @”text/javascript”, nil];
或者在设置请求接口的时候在
AFHTTPSessionManager 设置
responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@”application/json”, @”text/json”, @”text/javascript”,@”text/html”, nil];