简体   繁体   中英

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). 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). This is how I download a file from AWS S3 (upload is the same except I have defined contenType as well):

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? Should I rather compress any package content and upload as a .zip file? 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?

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. My other guess is to do with playing around with setting the content-type on your upload.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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