美文网首页
AFN:error:-1016

AFN:error:-1016

作者: 大牛大神 | 来源:发表于2017-07-12 09:19 被阅读51次
截图

_istance.manager.responseSerializer.acceptableContentTypes =

[NSSet setWithObjects:@"text/plain",@"application/json", @"text/json",

@"text/javascript", @"text/html" ,nil];

AFN报错-1016   需要的content-type都写了,但是还是说不行,缺少类型

先检查上面的代码是不是写全了需要的类型,如果没有

解决方法:

找到AFN#import "AFURLResponseSerialization.h"的类  在.m文件里 的以下方法里手动添加:

- (instancetype)init {

self = [super init];

if (!self) {

return nil;

}

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

return self;

}

就ok了

相关文章

网友评论

      本文标题:AFN:error:-1016

      本文链接:https://www.haomeiwen.com/subject/ezwvhxtx.html