AFNetworking 的x-www-form-urlenco

2017-06-23  本文已影响0人  eb7a9dac29d0

AFHTTPSessionManager*manager = [AFHTTPSessionManager manager];

NSMutableURLRequest* formRequest = [[AFHTTPRequestSerializer serializer]requestWithMethod:@"POST" URLString:@"http://192.168.2.8:8080/api/v1/msSysUser/updateUser" parameters:params error:nil];

[formRequest setValue:[WMUserDataManager readtoken] forHTTPHeaderField:@"payload"];

[formRequest setValue:@"application/x-www-form-urlencoded;charset=utf-8"forHTTPHeaderField:@"Content-Type"];

AFJSONResponseSerializer* responseSerializer = [AFJSONResponseSerializer serializer];

manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/html", @"text/json", @"text/plain", @"text/javascript", @"text/xml", @"image/*", nil];

manager.responseSerializer = responseSerializer;

NSURLSessionDataTask*dataTask = [manager dataTaskWithRequest:formRequest uploadProgress:^(NSProgress * _Nonnull uploadProgress) {

//        DLog(@"uploadUserInfoNetworking个人信息uploadProgress:%@",uploadProgress);

} downloadProgress:^(NSProgress * _Nonnull downloadProgress) {

//        DLog(@"uploadUserInfoNetworking个人信息downloadProgress:%@",downloadProgress);

} completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {

DLog(@"uploadUserInfoNetworking个人信息responseObject:%@",responseObject);

DLog(@"uploadUserInfoNetworking个人信息error:%@",error);

}];

[dataTask resume];

上一篇下一篇

猜你喜欢

热点阅读