AFNetworking請求數據失敗

使用AFNetworking庫 post方式請求php接口時,報下面的錯誤javascript

NSLocalizedDescription=Request failed: unacceptable content-type: text/htmlphp

 

網上找到了解決辦法,在這裏記錄一下html

修改AFNetworking/AFURLResponseSerialization.m文件java

 

- (instancetype)init {
    self = [super init];
    if (!self) {
        return nil;
    }

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

    return self;
}

acceptableContentTypes 中增長 @"text/html"json

相關文章
相關標籤/搜索