用AFNetworking的時候,報警告:"Request failed: unacceptable content-type: text/plain"。百度出來說AFNetworking不支持text/plain,這個格式。
解決辦法1.:在頭文件"AFURLResponseSerialization.m"的如下地方添加text/plain就行了。問題解決。
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/plain",@"text/json", @"text/javascript", nil];
解決辦法2.添加一句代碼:
AFHTTPSessionManager *mgr = [AFHTTPSessionManager manager];
mgr.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"application/json", @"text/json", @"text/javascript",nil];