[NFNetwork专题] post x-www-form-urlencoded 失败

失败的配置如下:

sessionManager.requestSerializer = [AFJSONRequestSerializer serializer];
    [sessionManager.requestSerializer setValue:@"application/x-www-form-urlencoded;charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    sessionManager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", @"text/plain",nil];
    sessionManager.requestSerializer.timeoutInterval = 30.0;
    
    NSSet *set = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", @"text/html", @"text/xml", @"text/plain", nil];
   sessionManager.responseSerializer.acceptableContentTypes = [sessionManager.responseSerializer.acceptableContentTypes setByAddingObjectsFromSet:set];
    
    [sessionManager POST:urlString parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        
    }];

一直失败

修复方案:
删除如下代码接口,可能重置了NFNetwork内部的设置信息

sessionManager.requestSerializer = [AFJSONRequestSerializer serializer];

你可能感兴趣的:([NFNetwork专题] post x-www-form-urlencoded 失败)