关于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);

        }];

 

posted @ 2016-09-01 09:52  iOS_XL_NSArray  阅读(3359)  评论(0编辑  收藏  举报