Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: image/gif" UserInfo={NSLocalizedDescription=Request failed: unacceptable content-type: image/gif,
此錯誤意思是不能接收的返回值類型: image/gif,即服務(wù)器返回了一個 image/gif類型的返回值。
出現(xiàn)原因為AFN本身不能接受這種類型,默認(rèn)接收類型只有application/json,text/json,text/javascript三種。
解決方案:為AFN添加此接收類型:
AFHTTPSessionManager *manager=[AFHTTPSessionManager manager];
manager.reesponseSerializer.acceptableContentTypes = [NSSet setWithObjects: @"application/json", @"text/json", @"text/javascript",@"text/plain",@"image/gif",nil];
參考:http://www.itdecent.cn/p/fedda77e27da
3840錯誤
Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set."
如上錯誤提示,是因為服務(wù)器返回數(shù)據(jù)不是正常的json數(shù)據(jù),解析不了,