首页 > 代码库 > 关于AF请求报错Request failed: unacceptable content-type: text/plain 解决方案

关于AF请求报错Request failed: unacceptable content-type: text/plain 解决方案

NSString *path = @"/resource/getNotice";

    NSString *UrlStr = [NSString stringWithFormat:@"%@%@",TCTHttpUrl,path];

    NSDictionary *parameters = @{@"pageNo":@"1",@"pageSize":@"10"};

    

    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

    manager.responseSerializer.acceptableContentTypes = nil;  -------》》》》》这个就是解决方法

    [manager POST:UrlStr parameters:parameters progress:^(NSProgress * _Nonnull uploadProgress) {

    

        } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {

    

            NSLog(@"%@",responseObject);

    

        } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {

            NSLog(@"%@",error);

        }];

 

关于AF请求报错Request failed: unacceptable content-type: text/plain 解决方案