5.2 Transferring Data using Bayun's SecureAWSS3TransferUtility

Now in order to use Bayun’s SecureAWSS3TransferUtility instead of the standard AWS S3 AWSS3TransferUtility, these code snippets above change to using “Secure” version, as below:

Add the following import statement in Objective-C:

#import "SecureAWSS3TransferUtility.h"

As you can see from the code snippets below, in general it should be possible to simply query-replace the following type-names appropriately to their secure versions, and in most situations that should be sufficient.

AWSS3TransferUtility --> SecureAWSS3TransferUtility

5.2.1 Configuring the Application Delegate

The Secure Transfer Utility for iOS uses the background transfer feature in iOS to continue data transfers even when your app isn’t running.

Call the following class method in your - application:handleEventsForBackgroundURLSession:completionHandler: application delegate so that iOS can tell the Transfer Utility when the transfer finishes while the app is not suspended.

- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier
  completionHandler:(void (^)())completionHandler {
    /* Store the completion handler.*/
    [SecureAWSS3TransferUtility interceptApplication:application handleEventsForBackgroundURLSession:identifier completionHandler:completionHandler];
}

5.2.2 Uploading a file using SecureAWSS3TransferUtility

To upload a file call uploadFile:bucket:key:contentType:expression:completionHander: on SecureAWSS3TransferUtility:

5.2.3 Downloading to a File using SecureAWSS3TransferUtility

Here are code snippets you can use for downloading to a file.

Last updated

Was this helpful?