AFN:error:-1016

截图


_istance.manager.responseSerializer.acceptableContentTypes =

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

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


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

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


AFN:error:-1016_第1张图片


解决方法:

找到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;

}



AFN:error:-1016_第2张图片

就ok了

你可能感兴趣的:(AFN:error:-1016)