简体   繁体   English

如何将应用程序包内容上传到 AWS S3

[英]How to upload app package contents to AWS S3

I use AWS SDK iOS v2.8.2 to upload and download files to AWS S3 and it works great with the exception of application packages (.app).我使用 AWS SDK iOS v2.8.2 将文件上传和下载到 AWS S3,除了应用程序包 (.app) 之外,它运行良好。 As these packages are basically layers of sub-folders that's how I have been uploading and downloading them, but the .app files are corrupted or damaged when I try to run them (after upload or download).由于这些包基本上是子文件夹层,这就是我上传和下载它们的方式,但是当我尝试运行它们时(上传或下载后).app 文件已损坏或损坏。 This is how I download a file from AWS S3 (upload is the same except I have defined contenType as well):这是我从 AWS S3 下载文件的方式(上传是相同的,除了我还定义了 contenType):

NSURL *downloadedLocationURL=[NSURL fileURLWithPath:downloadedLocationstring];
NSFileManager *fileManager= [NSFileManager defaultManager];
[fileManager createDirectoryAtPath: [downloadedLocationURL.URLByDeletingLastPathComponent path]
       withIntermediateDirectories:YES
                        attributes:nil
                             error:NULL];

self.transferUtility = [AWSS3TransferUtility S3TransferUtilityForKey:currentBucket.regionShortName];

[self.transferUtility downloadToURL:downloadedLocationURL
                             bucket:bucket.name
                                key:key
                         expression:expression
                  completionHandler:completionHandler]

I realized that I need to upload the package in a different way but I am not sure how to.我意识到我需要以不同的方式上传包,但我不确定如何上传。 Should I define the contentType in any way?我应该以任何方式定义 contentType 吗? Should I rather compress any package content and upload as a .zip file?我应该压缩任何包内容并上传为 .zip 文件吗? Most other file formats seem to function correctly so I wonder what is the trick with app packages may be that I am unable to see.大多数其他文件格式似乎都可以正常运行,所以我想知道应用程序包的技巧可能是我看不到的。

Thanks for your help.谢谢你的帮助。

Have you confirmed through AWS S3 console that the uploaded object is as you expect it to be?您是否通过 AWS S3 控制台确认上传的对象与您预期的一样?

You can directly download the file from the AWS console and reference it back where you need it to first ensure that the upload was done correctly.您可以直接从 AWS 控制台下载文件并将其引用回您需要的位置,以首先确保正确完成上传。 My other guess is to do with playing around with setting the content-type on your upload.我的另一个猜测是在上传时设置内容类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM