网络请求有时候报错"Request failed: unacceptable content-type: text/plain"
解决办法: 在基类初始化时新增以下方法即可
- (void)converContentTypeConfig{
YTKNetworkAgent *agent = [YTKNetworkAgent sharedAgent];
NSSet *acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/plain", @"text/html", @"text/css", nil];
NSString *keypath = @"jsonResponseSerializer.acceptableContentTypes";
[agent setValue:acceptableContentTypes forKeyPath:keypath];
}
标签:acceptableContentTypes,text,iOS,agent,json,YTKNetworking,plain
From: https://www.cnblogs.com/qqcc1388/p/17696376.html