AWSS3TransferUtility

Objective-C

@interface AWSS3TransferUtility

Swift

class AWSS3TransferUtility

A high-level utility for managing background uploads and downloads. The transfers continue even when the app is suspended. You must call + application:handleEventsForBackgroundURLSession:completionHandler: in the - application:handleEventsForBackgroundURLSession:completionHandler: application delegate in order for the background transfer callback to work.

  • The service configuration used to instantiate this service client.

    Warning

    Once the client is instantiated, do not modify the configuration object. It may cause unspecified behaviors.

    Declaration

    Objective-C

    @property (readonly) int *_Nonnull configuration;

    Swift

    var configuration: UnsafeMutablePointer<Int32> { get }
  • The transfer utility configuration.

    Declaration

    Objective-C

    @property (readonly) AWSS3TransferUtilityConfiguration *_Nonnull transferUtilityConfiguration;

    Swift

    var transferUtilityConfiguration: AWSS3TransferUtilityConfiguration { get }
  • Indicates if completed tasks should be removed. Off by default.

    Declaration

    Objective-C

    @property BOOL shouldRemoveCompletedTasks;

    Swift

    var shouldRemoveCompletedTasks: Bool { get set }
  • Returns the singleton service client. If the singleton object does not exist, the SDK instantiates the default service client with defaultServiceConfiguration from [AWSServiceManager defaultServiceManager]. The reference to this object is maintained by the SDK, and you do not need to retain it manually.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
        let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
        AWSServiceManager.default().defaultServiceConfiguration = configuration
    
        return true
    }
    

    Objective-C

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
         AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                         identityPoolId:@"YourIdentityPoolId"];
         AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1
                                                                              credentialsProvider:credentialsProvider];
         [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
    
         return YES;
     }
    

    Then call the following to get the default service client:

    Swift

    let S3TransferUtility = AWSS3TransferUtility.default()
    

    Objective-C

    AWSS3TransferUtility *S3TransferUtility = [AWSS3TransferUtility defaultS3TransferUtility];
    

    Declaration

    Objective-C

    + (nonnull instancetype)defaultS3TransferUtility;

    Swift

    class func `default`() -> Self

    Return Value

    The default service client.

  • Returns the singleton service client. If the singleton object does not exist, the SDK instantiates the default service client with defaultServiceConfiguration from [AWSServiceManager defaultServiceManager]. The reference to this object is maintained by the SDK, and you do not need to retain it manually.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: “YourIdentityPoolId”) let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider) AWSServiceManager.default().defaultServiceConfiguration = configuration

    return true }

    Objective-C

    • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@“YourIdentityPoolId”]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider]; [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;

    return YES; }

    Then call the following to get the default service client:

    Swift

    let S3TransferUtility = AWSS3TransferUtility.default() { (error) in

    }

    Objective-C

    AWSS3TransferUtility *S3TransferUtility = [AWSS3TransferUtility defaultS3TransferUtility:^(NSError * _Nullable error) {

    }];

    Declaration

    Objective-C

    + (nonnull instancetype)defaultS3TransferUtility:
        (nullable void (^)(NSError *_Nullable))completionHandler;

    Swift

    class func `default`(completionHandler: ((Error?) -> Void)? = nil) -> Self

    Parameters

    completionHandler

    The completion handler to call when the TransferUtility finishes loading transfers from prior sessions, or fails to instantiate.

    Return Value

    The default service client.

  • Creates a service client with the given service configuration and registers it for the key.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
        let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
        AWSS3TransferUtility.register(with: configuration!, forKey: "USWest2S3TransferUtility")
    
        return true
    }
    

    Objective-C

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                        identityPoolId:@"YourIdentityPoolId"];
        AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                             credentialsProvider:credentialsProvider];
    

    [AWSS3TransferUtility registerS3TransferUtilityWithConfiguration:configuration forKey:@“USWest2S3TransferUtility” completionHandler:^(NSError * _Nullable error) {

    }];

        return YES;
    }
    

    Then call the following to get the service client:

    Swift

    let S3TransferUtility = AWSS3TransferUtility(forKey: "USWest2S3TransferUtility")
    

    Objective-C

    AWSS3TransferUtility *S3TransferUtility = [AWSS3TransferUtility S3TransferUtilityForKey:@"USWest2S3TransferUtility"];
    

    Warning

    After calling this method, do not modify the configuration object. It may cause unspecified behaviors.

    Declaration

    Objective-C

    + (void)registerS3TransferUtilityWithConfiguration:(id)configuration
                                                forKey:(nonnull NSString *)key;

    Swift

    class func register(withConfiguration configuration: Any!, forKey key: String)

    Parameters

    configuration

    A service configuration object.

    key

    A string to identify the service client.

  • Creates a service client with the given service configuration and registers it for the key.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: “YourIdentityPoolId”) let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider) AWSS3TransferUtility.register(with: configuration!, forKey: “USWest2S3TransferUtility”){ (error) in

    }

    return true }

    Objective-C

    • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@“YourIdentityPoolId”]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider];

    [AWSS3TransferUtility registerS3TransferUtilityWithConfiguration:configuration forKey:@“USWest2S3TransferUtility” completionHandler:^(NSError * _Nullable error) {

    }];

    return YES; }

    Then call the following to get the service client:

    Swift

    let S3TransferUtility = AWSS3TransferUtility(forKey: “USWest2S3TransferUtility”)

    Objective-C

    AWSS3TransferUtility *S3TransferUtility = [AWSS3TransferUtility S3TransferUtilityForKey:@“USWest2S3TransferUtility”];

    Warning

    After calling this method, do not modify the configuration object. It may cause unspecified behaviors.

    Declaration

    Objective-C

    + (void)registerS3TransferUtilityWithConfiguration:(id)configuration
                                                forKey:(nonnull NSString *)key
                                     completionHandler:
                                         (nullable void (^)(NSError *_Nullable))
                                             completionHandler;

    Swift

    class func register(withConfiguration configuration: Any!, forKey key: String) async throws

    Parameters

    configuration

    A service configuration object.

    key

    A string to identify the service client.

    completionHandler

    The completion handler to call when the TransferUtility finishes loading transfers from prior sessions, or fails to instantiate.

  • Creates a service client with the given service configuration and registers it for the key.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
        let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
        AWSS3TransferUtility.register(with: configuration!, transferUtilityConfiguration: nil, forKey: "USWest2S3TransferUtility") { (error) in
    
        }
        return true
    }
    

    Objective-C

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                        identityPoolId:@"YourIdentityPoolId"];
        AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                             credentialsProvider:credentialsProvider];
    
        [AWSS3TransferUtility registerS3TransferUtilityWithConfiguration:configuration transferUtilityConfiguration:nil forKey:@"USWest2S3TransferUtility"];
    
        return YES;
    }
    

    Then call the following to get the service client:

    Swift

    let S3TransferUtility = AWSS3TransferUtility(forKey: "USWest2S3TransferUtility")
    

    Objective-C

    AWSS3TransferUtility *S3TransferUtility = [AWSS3TransferUtility S3TransferUtilityForKey:@"USWest2S3TransferUtility"];
    

    Warning

    After calling this method, do not modify the configuration object. It may cause unspecified behaviors.

    Declaration

    Objective-C

    + (void)registerS3TransferUtilityWithConfiguration:(id)configuration
                          transferUtilityConfiguration:
                              (nullable AWSS3TransferUtilityConfiguration *)
                                  transferUtilityConfiguration
                                                forKey:(nonnull NSString *)key;

    Swift

    class func register(withConfiguration configuration: Any!, transferUtilityConfiguration: AWSS3TransferUtilityConfiguration?, forKey key: String)

    Parameters

    configuration

    A service configuration object.

    transferUtilityConfiguration

    An S3 transfer utility configuration object.

    key

    A string to identify the service client.

  • Creates a service client with the given service configuration and registers it for the key.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    Swift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: “YourIdentityPoolId”) let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider) AWSS3TransferUtility.register(with: configuration!, transferUtilityConfiguration: nil, forKey: “USWest2S3TransferUtility”) { (error) in

    }

    return true }

    Objective-C

    • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@“YourIdentityPoolId”]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider];

    [AWSS3TransferUtility registerS3TransferUtilityWithConfiguration:configuration transferUtilityConfiguration:nil forKey:@“USWest2S3TransferUtility” completionHandler:^(NSError * _Nullable error) {

    }];

    return YES; }

    Then call the following to get the service client:

    Swift

    let S3TransferUtility = AWSS3TransferUtility(forKey: “USWest2S3TransferUtility”)

    Objective-C

    AWSS3TransferUtility *S3TransferUtility = [AWSS3TransferUtility S3TransferUtilityForKey:@“USWest2S3TransferUtility”];

    Warning

    After calling this method, do not modify the configuration object. It may cause unspecified behaviors.

    Declaration

    Objective-C

    + (void)registerS3TransferUtilityWithConfiguration:(id)configuration
                          transferUtilityConfiguration:
                              (nullable AWSS3TransferUtilityConfiguration *)
                                  transferUtilityConfiguration
                                                forKey:(nonnull NSString *)key
                                     completionHandler:
                                         (nullable void (^)(NSError *_Nullable))
                                             completionHandler;

    Swift

    class func register(withConfiguration configuration: Any!, transferUtilityConfiguration: AWSS3TransferUtilityConfiguration?, forKey key: String) async throws

    Parameters

    configuration

    A service configuration object.

    transferUtilityConfiguration

    An S3 transfer utility configuration object.

    key

    A string to identify the service client.

    completionHandler

    The completion handler to call when the TransferUtility finishes loading transfers from prior sessions, or fails to instantiate.

  • Retrieves the service client associated with the key. You need to call + registerS3TransferUtilityWithConfiguration:forKey: before invoking this method.

    For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        AWSCognitoCredentialsProvider *credentialsProvider = [AWSCognitoCredentialsProvider credentialsWithRegionType:AWSRegionUSEast1 identityPoolId:@"YourIdentityPoolId"];
        AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider];
    
        [AWSS3TransferUtility registerS3TransferUtilityWithConfiguration:configuration forKey:@"USWest2S3TransferUtility"];
    
        return YES;
    }
    

    Then call the following to get the service client (the value of the client will be null if the + registerS3TransferUtilityWithConfiguration:forKey: failed):

    AWSS3TransferUtility? *S3TransferUtility = [AWSS3TransferUtility S3ForKey:@"USWest2S3TransferUtility"];
    

    Declaration

    Objective-C

    + (nullable instancetype)S3TransferUtilityForKey:(nonnull NSString *)key;

    Swift

    class func s3TransferUtility(forKey key: String) -> Self?

    Parameters

    key

    A string to identify the service client.

    Return Value

    An instance of the service client.

  • Removes the service client associated with the key and release it.

    The underlying NSURLSession is invalidated, and after the invalidation has completed the transfer is utility removed.

    Observe the AWSS3TransferUtilityURLSessionDidBecomeInvalidNotification to be informed when this has occurred.

    Warning

    Before calling this method, make sure no method is running on this client.

    Declaration

    Objective-C

    + (void)removeS3TransferUtilityForKey:(nonnull NSString *)key;

    Swift

    class func remove(forKey key: String)

    Parameters

    key

    A string to identify the service client.

  • Tells AWSS3TransferUtility that events related to a URL session are waiting to be processed. This method needs to be called in the - application:handleEventsForBackgroundURLSession:completionHandler: application delegate for AWSS3TransferUtility to work.

    Declaration

    Objective-C

    + (void)interceptApplication:(nonnull UIApplication *)application
        handleEventsForBackgroundURLSession:(nonnull NSString *)identifier
                          completionHandler:
                              (nonnull void (^)(void))completionHandler;

    Swift

    class func interceptApplication(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String) async

    Parameters

    application

    The singleton app object.

    identifier

    The identifier of the URL session requiring attention.

    completionHandler

    The completion handler to call when you finish processing the events.

  • Saves the NSData to a temporary directory and uploads it to the configured Amazon S3 bucket in AWSS3TransferUtilityConfiguration.

    Declaration

    Objective-C

    - (id)uploadData:(nonnull NSData *)data
                      key:(nonnull NSString *)key
              contentType:(nonnull NSString *)contentType
               expression:
                   (nullable AWSS3TransferUtilityUploadExpression *)expression
        completionHandler:
            (nullable AWSS3TransferUtilityUploadCompletionHandlerBlock)
                completionHandler;

    Swift

    func uploadData(_ data: Data, key: String, contentType: String, expression: AWSS3TransferUtilityUploadExpression?, completionHandler: AWSS3TransferUtilityUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    data

    The data to upload.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the data.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityUploadTask.

  • Saves the NSData to a temporary directory and uploads it to the specified Amazon S3 bucket.

    Declaration

    Objective-C

    - (id)uploadData:(nonnull NSData *)data
                   bucket:(nonnull NSString *)bucket
                      key:(nonnull NSString *)key
              contentType:(nonnull NSString *)contentType
               expression:
                   (nullable AWSS3TransferUtilityUploadExpression *)expression
        completionHandler:
            (nullable AWSS3TransferUtilityUploadCompletionHandlerBlock)
                completionHandler;

    Swift

    func uploadData(_ data: Data, bucket: String, key: String, contentType: String, expression: AWSS3TransferUtilityUploadExpression?, completionHandler: AWSS3TransferUtilityUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    data

    The data to upload.

    bucket

    The Amazon S3 bucket name.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the data.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityUploadTask.

  • Uploads the file to the configured Amazon S3 bucket in AWSS3TransferUtilityConfiguration.

    Declaration

    Objective-C

    - (id)uploadFile:(nonnull NSURL *)fileURL
                      key:(nonnull NSString *)key
              contentType:(nonnull NSString *)contentType
               expression:
                   (nullable AWSS3TransferUtilityUploadExpression *)expression
        completionHandler:
            (nullable AWSS3TransferUtilityUploadCompletionHandlerBlock)
                completionHandler;

    Swift

    func uploadFile(_ fileURL: URL, key: String, contentType: String, expression: AWSS3TransferUtilityUploadExpression?, completionHandler: AWSS3TransferUtilityUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    fileURL

    The file URL of the file to upload.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the file.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityUploadTask.

  • Uploads the file to the specified Amazon S3 bucket.

    Declaration

    Objective-C

    - (id)uploadFile:(nonnull NSURL *)fileURL
                   bucket:(nonnull NSString *)bucket
                      key:(nonnull NSString *)key
              contentType:(nonnull NSString *)contentType
               expression:
                   (nullable AWSS3TransferUtilityUploadExpression *)expression
        completionHandler:
            (nullable AWSS3TransferUtilityUploadCompletionHandlerBlock)
                completionHandler;

    Swift

    func uploadFile(_ fileURL: URL, bucket: String, key: String, contentType: String, expression: AWSS3TransferUtilityUploadExpression?, completionHandler: AWSS3TransferUtilityUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    fileURL

    The file URL of the file to upload.

    bucket

    The Amazon S3 bucket name.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the file.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityUploadTask.

  • Saves the NSData to a temporary directory and uploads it to the configured Amazon S3 bucket in AWSS3TransferUtilityConfiguration using Multipart.

    Declaration

    Objective-C

    - (id)
        uploadDataUsingMultiPart:(nonnull NSData *)data
                             key:(nonnull NSString *)key
                     contentType:(nonnull NSString *)contentType
                      expression:
                          (nullable AWSS3TransferUtilityMultiPartUploadExpression *)
                              expression
               completionHandler:
                   (nullable
                        AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock)
                       completionHandler;

    Swift

    func uploadUsingMultiPart(data: Data, key: String, contentType: String, expression: AWSS3TransferUtilityMultiPartUploadExpression?, completionHandler: AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    data

    The data to upload.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the data.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityMultiPartUploadTask.

  • Saves the NSData to a temporary directory and uploads it to the specified Amazon S3 bucket using Multipart.

    Declaration

    Objective-C

    - (id)
        uploadDataUsingMultiPart:(nonnull NSData *)data
                          bucket:(nonnull NSString *)bucket
                             key:(nonnull NSString *)key
                     contentType:(nonnull NSString *)contentType
                      expression:
                          (nullable AWSS3TransferUtilityMultiPartUploadExpression *)
                              expression
               completionHandler:
                   (nullable
                        AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock)
                       completionHandler;

    Swift

    func uploadUsingMultiPart(data: Data, bucket: String, key: String, contentType: String, expression: AWSS3TransferUtilityMultiPartUploadExpression?, completionHandler: AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    data

    The data to upload.

    bucket

    The Amazon S3 bucket name.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the data.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityMultiPartUploadTask.

  • Uploads the file to the configured Amazon S3 bucket in AWSS3TransferUtilityConfiguration using MultiPart.

    Declaration

    Objective-C

    - (id)
        uploadFileUsingMultiPart:(nonnull NSURL *)fileURL
                             key:(nonnull NSString *)key
                     contentType:(nonnull NSString *)contentType
                      expression:
                          (nullable AWSS3TransferUtilityMultiPartUploadExpression *)
                              expression
               completionHandler:
                   (nullable
                        AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock)
                       completionHandler;

    Swift

    func uploadUsingMultiPart(fileURL: URL, key: String, contentType: String, expression: AWSS3TransferUtilityMultiPartUploadExpression?, completionHandler: AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    fileURL

    The file URL of the file to upload.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the file.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityMultiPartUploadTask.

  • Uploads the file to the specified Amazon S3 bucket using MultiPart.

    Declaration

    Objective-C

    - (id)
        uploadFileUsingMultiPart:(nonnull NSURL *)fileURL
                          bucket:(nonnull NSString *)bucket
                             key:(nonnull NSString *)key
                     contentType:(nonnull NSString *)contentType
                      expression:
                          (nullable AWSS3TransferUtilityMultiPartUploadExpression *)
                              expression
               completionHandler:
                   (nullable
                        AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock)
                       completionHandler;

    Swift

    func uploadUsingMultiPart(fileURL: URL, bucket: String, key: String, contentType: String, expression: AWSS3TransferUtilityMultiPartUploadExpression?, completionHandler: AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    fileURL

    The file URL of the file to upload.

    bucket

    The Amazon S3 bucket name.

    key

    The Amazon S3 object key name.

    contentType

    Content-Type of the file.

    expression

    The container object to configure the upload request.

    completionHandler

    The completion handler when the upload completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityMultiPartUploadTask.

  • Downloads the specified Amazon S3 object as NSData from the bucket configured in AWSS3TransferUtilityConfiguration.

    Declaration

    Objective-C

    - (id)downloadDataForKey:(nonnull NSString *)key
                  expression:
                      (nullable AWSS3TransferUtilityDownloadExpression *)expression
           completionHandler:
               (nullable AWSS3TransferUtilityDownloadCompletionHandlerBlock)
                   completionHandler;

    Swift

    func downloadData(forKey key: String, expression: AWSS3TransferUtilityDownloadExpression?, completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    key

    The Amazon S3 object key name.

    expression

    The container object to configure the download request.

    completionHandler

    The completion handler when the download completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityDownloadTask.

  • Downloads the specified Amazon S3 object as NSData.

    Declaration

    Objective-C

    - (id)downloadDataFromBucket:(nonnull NSString *)bucket
                             key:(nonnull NSString *)key
                      expression:(nullable AWSS3TransferUtilityDownloadExpression *)
                                     expression
               completionHandler:
                   (nullable AWSS3TransferUtilityDownloadCompletionHandlerBlock)
                       completionHandler;

    Swift

    func downloadData(fromBucket bucket: String, key: String, expression: AWSS3TransferUtilityDownloadExpression?, completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    bucket

    The Amazon S3 bucket name.

    key

    The Amazon S3 object key name.

    expression

    The container object to configure the download request.

    completionHandler

    The completion handler when the download completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityDownloadTask.

  • Downloads the specified Amazon S3 object to a file URL from the bucket configured in AWSS3TransferUtilityConfiguration.

    Declaration

    Objective-C

    - (id)downloadToURL:(nonnull NSURL *)fileURL
                      key:(nonnull NSString *)key
               expression:
                   (nullable AWSS3TransferUtilityDownloadExpression *)expression
        completionHandler:
            (nullable AWSS3TransferUtilityDownloadCompletionHandlerBlock)
                completionHandler;

    Swift

    func download(to fileURL: URL, key: String, expression: AWSS3TransferUtilityDownloadExpression?, completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    fileURL

    The file URL to download the object to.

    key

    The Amazon S3 object key name.

    expression

    The container object to configure the download request.

    completionHandler

    The completion handler when the download completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityDownloadTask.

  • Downloads the specified Amazon S3 object to a file URL.

    Declaration

    Objective-C

    - (id)downloadToURL:(nonnull NSURL *)fileURL
                   bucket:(nonnull NSString *)bucket
                      key:(nonnull NSString *)key
               expression:
                   (nullable AWSS3TransferUtilityDownloadExpression *)expression
        completionHandler:
            (nullable AWSS3TransferUtilityDownloadCompletionHandlerBlock)
                completionHandler;

    Swift

    func download(to fileURL: URL, bucket: String, key: String, expression: AWSS3TransferUtilityDownloadExpression?, completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock? = nil) -> Any!

    Parameters

    fileURL

    The file URL to download the object to.

    bucket

    The Amazon S3 bucket name.

    key

    The Amazon S3 object key name.

    expression

    The container object to configure the download request.

    completionHandler

    The completion handler when the download completes.

    Return Value

    Returns an instance of AWSTask. On successful initialization, task.result contains an instance of AWSS3TransferUtilityDownloadTask.

  • Deprecated

    Use enumerateToAssignBlocks: instead.

    Assigns progress feedback and completion handler blocks. This method should be called when the app was suspended while the transfer is still happening.

    Declaration

    Objective-C

    - (void)
        enumerateToAssignBlocksForUploadTask:
            (nullable void (^)(
                AWSS3TransferUtilityUploadTask *_Nonnull,
                AWSS3TransferUtilityProgressBlock _Nullable *_Nullable,
                AWSS3TransferUtilityUploadCompletionHandlerBlock _Nullable
                    *_Nullable))uploadBlocksAssigner
                                downloadTask:
                                    (nullable void (^)(
                                        AWSS3TransferUtilityDownloadTask *_Nonnull,
                                        AWSS3TransferUtilityProgressBlock _Nullable
                                            *_Nullable,
                                        AWSS3TransferUtilityDownloadCompletionHandlerBlock _Nullable
                                            *_Nullable))downloadBlocksAssigner;

    Swift

    func enumerateToAssignBlocks(forUploadTask uploadBlocksAssigner: ((AWSS3TransferUtilityUploadTask, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityTask, Progress) -> Void)?>?, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityUploadTask, Error?) -> Void)?>?) -> Void)?, downloadTask downloadBlocksAssigner: ((AWSS3TransferUtilityDownloadTask, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityTask, Progress) -> Void)?>?, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityDownloadTask, URL?, Data?, Error?) -> Void)?>?) -> Void)? = nil)

    Parameters

    uploadBlocksAssigner

    The block for assigning the upload progress feedback and completion handler blocks.

    downloadBlocksAssigner

    The block for assigning the download progress feedback and completion handler blocks.

  • Deprecated

    Use enumerateToAssign(blocks:) instead.

    Assigns progress feedback and completion handler blocks. This method should be called when the app was suspended while the transfer is still happening.

    Declaration

    Objective-C

    - (void)
        enumerateToAssignBlocksForUploadTask:
            (nonnull void (^)(
                AWSS3TransferUtilityUploadTask *_Nonnull,
                AWSS3TransferUtilityProgressBlock _Nullable *_Nullable,
                AWSS3TransferUtilityUploadCompletionHandlerBlock _Nullable
                    *_Nullable))uploadBlocksAssigner
               multiPartUploadBlocksAssigner:
                   (nonnull void (^)(
                       AWSS3TransferUtilityMultiPartUploadTask *_Nonnull,
                       AWSS3TransferUtilityMultiPartProgressBlock _Nullable
                           *_Nullable,
                       AWSS3TransferUtilityMultiPartUploadCompletionHandlerBlock _Nullable
                           *_Nullable))multiPartUploadBlocksAssigner
                      downloadBlocksAssigner:
                          (nonnull void (^)(
                              AWSS3TransferUtilityDownloadTask *_Nonnull,
                              AWSS3TransferUtilityProgressBlock _Nullable
                                  *_Nullable,
                              AWSS3TransferUtilityDownloadCompletionHandlerBlock _Nullable
                                  *_Nullable))downloadBlocksAssigner;

    Swift

    func enumerateToAssignBlocks(forUploadTask uploadBlocksAssigner: @escaping (AWSS3TransferUtilityUploadTask, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityTask, Progress) -> Void)?>?, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityUploadTask, Error?) -> Void)?>?) -> Void, multiPartUploadBlocksAssigner: @escaping (AWSS3TransferUtilityMultiPartUploadTask, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityMultiPartUploadTask, Progress) -> Void)?>?, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityMultiPartUploadTask, Error?) -> Void)?>?) -> Void, downloadBlocksAssigner: @escaping (AWSS3TransferUtilityDownloadTask, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityTask, Progress) -> Void)?>?, AutoreleasingUnsafeMutablePointer<((AWSS3TransferUtilityDownloadTask, URL?, Data?, Error?) -> Void)?>?) -> Void)

    Parameters

    uploadBlocksAssigner

    The block for assigning the upload progress feedback and completion handler blocks.

    multiPartUploadBlocksAssigner

    The block for assigning the multipart upload progress feedback and completion handler blocks.

    downloadBlocksAssigner

    The block for assigning the download progress feedback and completion handler blocks.

  • Deprecated

    Retrieves all running tasks. @deprecated Use getUploadTasks:, getMultiPartUploadTasks: and getDownloadTasks: methods instead.

    Declaration

    Objective-C

    - (id)getAllTasks;

    Swift

    func getAllTasks() -> Any!

    Return Value

    An array of containing AWSS3TransferUtilityUploadTask and AWSS3TransferUtilityDownloadTask objects.

  • Retrieves all running upload tasks.

    Declaration

    Objective-C

    - (id)getUploadTasks;

    Swift

    func getUploadTasks() -> Any!

    Return Value

    An array of AWSS3TransferUtilityUploadTask.

  • Retrieves all running MultiPart upload tasks.

    Declaration

    Objective-C

    - (id)getMultiPartUploadTasks;

    Swift

    func getMultiPartUploadTasks() -> Any!

    Return Value

    An array of AWSS3TransferUtilityMultiPartUploadTask.

  • Retrieves all running download tasks.

    Declaration

    Objective-C

    - (id)getDownloadTasks;

    Swift

    func getDownloadTasks() -> Any!

    Return Value

    An array of AWSS3TransferUtilityDownloadTask.

EnumerateBlocks

  • Assigns blocks for uploads, multipart uploads and downloads. This method should be called when the app was suspended while the transfer is still happening.

    Declaration

    Objective-C

    - (void)enumerateToAssignBlocks:(nonnull AWSS3TransferUtilityBlocks *)blocks;

    Swift

    func enumerateToAssign(blocks: AWSS3TransferUtilityBlocks)

    Parameters

    blocks

    Transfer Utility Blocks for uploads, multipart uploads and downloads

  • Cancels all uploads, multipart uploads and downloads.

    This is a convenience function so that the enumerate method is not needed.

    Declaration

    Objective-C

    - (void)cancelAll;

    Swift

    func cancelAll()