AFNetworking使用application/x-www-form-urlencoded格式

安卓能够正常访问接口,iOS报500错误,原因是AFNetworing写了

[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
 AFHTTPRequestOperationManager * manager = [AFHTTPRequestOperationManager manager];
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    [manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    NSDictionary * dict = @{@"key":value};
    [manager POST:url parameters:dict success:^(AFHTTPRequestOperation * _Nonnull operation, id  _Nonnull responseObject) {
    
    } failure:^(AFHTTPRequestOperation * _Nonnull operation, NSError * _Nonnull error) {
    }]; 

你可能感兴趣的:(AFNetworking使用application/x-www-form-urlencoded格式)