美文网首页
AFNetworking 的x-www-form-urlenco

AFNetworking 的x-www-form-urlenco

作者: eb7a9dac29d0 | 来源:发表于2017-06-23 10:52 被阅读0次

    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];

    相关文章

      网友评论

          本文标题:AFNetworking 的x-www-form-urlenco

          本文链接:https://www.haomeiwen.com/subject/qfxccxtx.html