AF3.0 上传图片 报错-1016 Request faile
2017-08-10 本文已影响0人
guoshengboy
因为上传使用的是AFURLSessionManager ,而AFURLSessionManager默认的responseSerializer是AFURLResponseSerialization,而AFURLResponseSerialization默认是AFJSONResponseSerializer的一个实例,而AFJSONResponseSerializer不支持text/html。
解决方法:重新替换responseSerializer
AFHTTPResponseSerializer *responseSerializer = [AFHTTPResponseSerializer serializer];
responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", @"text/plain", nil];
manager.responseSerializer = responseSerializer;