• AFN实现多图片上传的方法


    [[AFAppDotNetAPIClient sharedClient] POST:path parameters:dic constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
            
            if (fieldArr != nil) {
                for (int i = 0; i<fieldArr.count; i++) {
                    
                    NSArray *photoArr = photoDic[fieldArr[i]];
                    
                    NSArray *cameraArr = cameraDic[fieldArr[i]];
                    
                    NSArray *voiceArr = voiceDIc[fieldArr[i]];
                    
                    NSString *ename =  enameDic[fieldArr[i]];
                    if (photoArr != nil) {
                        for (NSInteger i = 0; i<photoArr.count; i++) {
                            if ([photoArr[i] objectForKey:@"attach_id"] == nil ) {
                                NSData *imageData = [NSData dataWithContentsOfFile:[[photoArr objectAtIndex:i] objectForKey:@"path"]];
                                NSString *paramName = [NSString stringWithFormat:@"%@_%ld",[photoArr[i]objectForKey:@"ename"],(long)i];
                                NSArray *fileNameArray = [[[photoArr objectAtIndex:i] objectForKey:@"path"] componentsSeparatedByString:@"/"];
                                NSString *fileName = fileNameArray[[fileNameArray count]-1];
                                [formData appendPartWithFileData:imageData name:paramName fileName:fileName mimeType:@"image/*"];
                            }
                            
                            
                        }
                    }
    北京-Alexyeee_  16:12:02
    没写完。。。自行脑补。。

  • 相关阅读:
    权值线段树 学习笔记
    Codeforces Round #585 (Div. 2)
    a题解
    01Trie学习笔记
    学习笔记--线段树合并与分裂
    [NOIP10.6模拟赛]1.merchant题解--思维+二分
    [NOIP10.6模拟赛]2.equation题解--DFS序+线段树
    [NOIP10.5模拟赛]1.a题解--离散化+异或线段树
    [NOIP10.5模拟赛]3.c题解--思维
    [NOIP10.3模拟赛]3.w题解--神奇树形DP
  • 原文地址:https://www.cnblogs.com/lidongxiao/p/5148666.html
Copyright © 2020-2023  润新知