AFN:error:-1016

2017-07-12  本文已影响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了

上一篇 下一篇

猜你喜欢

热点阅读