Ios 通过RUBY开发的单个API上传多个文档面临的问题

Ios 通过RUBY开发的单个API上传多个文档面临的问题,ios,ruby-on-rails,asihttprequest,Ios,Ruby On Rails,Asihttprequest,我正试图通过点击一个API同时上传多个文档(比如:图像和视频)。该API是在RubyonRails中开发的。我正在尝试使用ASIHTTP方法在iPhone中上载文档。这是getpostman的截图。在getpostman上,它运行良好。多个文档工作正常,但当我在xcode中使用相同的API时,它会给我带来错误 到目前为止,我所做的是,我用了两种方法 1.)使用字典发送多个文档的数据。以下是代码片段:- [self setRequest:[ASIFormDataRequest requestWit

我正试图通过点击一个API同时上传多个文档(比如:图像和视频)。该API是在RubyonRails中开发的。我正在尝试使用ASIHTTP方法在iPhone中上载文档。这是getpostman的截图。在getpostman上,它运行良好。多个文档工作正常,但当我在xcode中使用相同的API时,它会给我带来错误

到目前为止,我所做的是,我用了两种方法

1.)使用字典发送多个文档的数据。以下是代码片段:-

[self setRequest:[ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://onepgr.com/docs/create6_api"]]];
[request setPostValue:@"11" forKey:@"clientname"];
[request setPostValue:@"1" forKey:@"onepgr_apicall"];
[request setPostValue:pageID forKey:@"page_id"];
//[request setPostValue:@"true" forKey:@"multiple"];
//[request setPostValue:array forKey:@"doc"];
[request setPostValue:@"" forKey:@"passcode"];
[request setPostValue:@"33" forKey:@"clientappkey"];
[request setPostValue:@"22" forKey:@"clientappid"];

[request setTimeOutSeconds:20];

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
[request setShouldContinueWhenAppEntersBackground:YES];
#endif
[request setUploadProgressDelegate:progressView];
[request setDelegate:self];
[request setDidFailSelector:@selector(uploadFailed:)];
[request setDidFinishSelector:@selector(uploadFinished:)];



//Uncomment For Multiple Upload

for (int i = 0; i<self.chosenImages.count; i++)
{
    UIImage *img = [self.chosenImages objectAtIndex:i];
    NSString *str = [NSString stringWithFormat:@"Image_File_%d.png",i+1];
    strFileName = str;
    strContentType = @"image/png";

    fileData = UIImageJPEGRepresentation(img, 1.0);

    if (i == 0)
        [request setData:fileData withFileName:strFileName andContentType:strContentType forKey:@"doc"];
    else
        [request addData:fileData withFileName:strFileName andContentType:strContentType forKey:@"doc"];
}
[self-setRequest:[AsiformDataRequestRequestWithURL:[NSURL URLWithString:@]http://onepgr.com/docs/create6_api"]]];
[请求setPostValue:@“11”forKey:@“clientname”];
[请求setPostValue:@“1”forKey:@“onepgr_apicall”];
[请求setPostValue:pageID forKey:@“page_id”];
//[请求setPostValue:@“true”forKey:@“multiple”];
//[请求setPostValue:数组forKey:@“doc”];
[请求setPostValue:@“forKey:@“passcode”];
[请求setPostValue:@“33”forKey:@“clientappkey”];
[请求setPostValue:@“22”forKey:@“clientappid”];
[请求setTimeOutSeconds:20];
#如果允许的IPHONE操作系统版本最大值>=\uiPhone 4\u0
[当输入背景:是时,请求设置应继续];
#恩迪夫
[请求setUploadProgressDelegate:progressView];
[请求setDelegate:self];
[请求setDidFailSelector:@selector(上传失败:)];
[请求setDidFinishSelector:@selector(上传完成:)];
//取消对多个上载的注释
对于(int i=0;i用于检查两个请求之间的差异

我个人打赌,问题在于你总是将循环中的图像数据设置为同一个键