美文网首页
iOS form-data表单提交

iOS form-data表单提交

作者: 可乐小子 | 来源:发表于2020-09-11 15:29 被阅读0次

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy defaultPolicy];
securityPolicy.validatesDomainName = NO;
securityPolicy.allowInvalidCertificates = YES;
manager.securityPolicy = securityPolicy;

NSDictionary  *params = (NSDictionary *)data;
[manager    POST:[NSString stringWithFormat:@"%@%@",APP_SERVER_ADDRESS,path]  parameters:params constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
     NSLog(@"formData  === %@",formData);
} progress:^(NSProgress * _Nonnull uploadProgress) {
     NSLog(@"uploadProgress  === %@",uploadProgress);
} success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
    NSLog(@"reposbObject === %@",responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
    NSLog(@"error  === %@",error);
}];

相关文章

网友评论

      本文标题:iOS form-data表单提交

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