Official mirror of version 2 of the AWS Mobile SDK for iOS. For more information, see our web site:
Objective-C Other
Permalink
Failed to load latest commit information.
.github The AWS Mobile SDK for iOS 2.6.19. May 24, 2018
AWSAPIGateway The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAPIGatewayTests The AWS Mobile SDK for iOS 2.6.2. Sep 27, 2017
AWSAPIGatewayUnitTests The AWS Mobile SDK for iOS 2.5.3. Apr 3, 2017
AWSAllTests The AWS Mobile SDK for iOS 2.4.3. May 31, 2016
AWSAllTestsHost The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAuthSDK The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAutoScaling The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAutoScalingTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSAutoScalingUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSCloudWatch The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCloudWatchTests The AWS Mobile SDK for iOS 2.6.23. Jul 6, 2018
AWSCloudWatchUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSCognito The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCognitoAuth The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCognitoAuthTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSCognitoAuthUnitTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSCognitoIdentityProvider The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCognitoIdentityProviderASF The AWS Mobile SDK for iOS 2.6.8. Dec 8, 2017
AWSCognitoIdentityProviderTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSCognitoIdentityProviderUnitTests The AWS Mobile SDK for iOS 2.6.12. Feb 9, 2018
AWSCognitoTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSCognitoUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSComprehend The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSComprehendTests The AWS Mobile SDK for iOS 2.6.19. May 24, 2018
AWSComprehendUnitTests The AWS Mobile SDK for iOS 2.6.19. May 24, 2018
AWSCore The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCoreTests The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCoreUnitTests The AWS Mobile SDK for iOS 2.6.25. Jul 18, 2018
AWSDynamoDB The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSDynamoDBTests format consistency Apr 11, 2018
AWSDynamoDBUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSEC2 The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSEC2Tests format consistency Apr 11, 2018
AWSEC2UnitTests The AWS Mobile SDK for iOS 2.6.20. Jun 1, 2018
AWSElasticLoadBalancing The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSElasticLoadBalancingTests The AWS Mobile SDK for iOS 2.6.2. Sep 27, 2017
AWSElasticLoadBalancingUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSIoT The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSIoTTests The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSIoTUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSKMS The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKMSTests The AWS Mobile SDK for iOS 2.6.5. Oct 27, 2017
AWSKMSUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSKinesis The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKinesisTests The AWS Mobile SDK for iOS 2.6.5. Oct 27, 2017
AWSKinesisUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSKinesisVideo The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKinesisVideoArchivedMedia The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKinesisVideoArchivedMediaTests The AWS Mobile SDK for iOS 2.6.25. Jul 18, 2018
AWSKinesisVideoArchivedMediaUnitTests Fix for pods in version 2.6.24 release (#994) Jul 14, 2018
AWSKinesisVideoTests The AWS Mobile SDK for iOS 2.6.25. Jul 18, 2018
AWSKinesisVideoUnitTests Fix for pods in version 2.6.24 release (#994) Jul 14, 2018
AWSLambda The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSLambdaTests The AWS Mobile SDK for iOS 2.5.7. May 18, 2017
AWSLambdaUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSLex The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSLexTests The AWS Mobile SDK for iOS 2.5.0. Jan 26, 2017
AWSLexUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSLogs The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSLogsUnitTests The AWS Mobile SDK for iOS 2.6.19. May 24, 2018
AWSMachineLearning The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSMachineLearningTests The AWS Mobile SDK for iOS 2.5.0. Jan 26, 2017
AWSMachineLearningUnitTests The AWS Mobile SDK for iOS 2.5.0. Jan 26, 2017
AWSMobileAnalytics The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSMobileAnalyticsLegacyTests Merge pull request #887 from Coeur/NSNumber Apr 27, 2018
AWSMobileAnalyticsTests The AWS Mobile SDK for iOS 2.5.0. Jan 26, 2017
AWSMobileAnalyticsUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSPinpoint The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSPinpointTests The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSPinpointUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSPolly The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSPollyTests The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSPollyUnitTests The AWS Mobile SDK for iOS 2.6.25. Jul 18, 2018
AWSRekognition The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSRekognitionTests The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSRekognitionUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSS3 The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSS3Tests The AWS Mobile SDK for iOS 2.6.25. Jul 18, 2018
AWSS3UnitTests The AWS Mobile SDK for iOS 2.6.15. Apr 10, 2018
AWSSES The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSESTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSSESUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSSNS The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSNSTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSSNSUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSSQS The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSQSTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSSQSUnitTests The AWS Mobile SDK for iOS 2.6.22. Jun 22, 2018
AWSSimpleDB The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSimpleDBTests The AWS Mobile SDK for iOS 2.5.8. Jun 2, 2017
AWSSimpleDBUnitTests The AWS Mobile SDK for iOS 2.6.11. Jan 19, 2018
AWSTranscribe The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSTranscribeTests The AWS Mobile SDK for iOS 2.6.18. May 11, 2018
AWSTranscribeUnitTests The AWS Mobile SDK for iOS 2.6.18. May 11, 2018
AWSTranslate The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSTranslateTests The AWS Mobile SDK for iOS 2.6.19. May 24, 2018
AWSTranslateUnitTests The AWS Mobile SDK for iOS 2.6.19. May 24, 2018
AWSiOSSDKv2.xcodeproj The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
Scripts The AWS Mobile SDK for iOS 2.6.25. Jul 18, 2018
readme-images The AWS Mobile SDK for iOS 2.4.0. Apr 19, 2016
.gitignore The AWS Mobile SDK for iOS 2.2.1. Jul 9, 2015
AWSAPIGateway.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAuth.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAuthCore.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAuthUI.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSAutoScaling.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCloudWatch.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCognito.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCognitoAuth.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCognitoIdentityProvider.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCognitoIdentityProviderASF.podspec The AWS Mobile SDK for iOS 2.6.12. Feb 9, 2018
AWSCognitoSync.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSComprehend.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSCore.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSDynamoDB.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSEC2.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSElasticLoadBalancing.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSFacebookSignIn.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSGoogleSignIn.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSIoT.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKMS.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKinesis.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKinesisVideo.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSKinesisVideoArchivedMedia.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSLambda.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSLex.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSLogs.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSMachineLearning.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSMobileAnalytics.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSMobileClient.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSPinpoint.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSPolly.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSRekognition.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSS3.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSES.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSNS.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSQS.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSSimpleDB.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSTranscribe.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSTranslate.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSUserPoolsSignIn.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
AWSiOSSDKv2.podspec The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
CHANGELOG.md The AWS Mobile SDK for iOS 2.6.25. Aug 3, 2018
LICENSE The AWS Mobile SDK for iOS 2.4.13. Nov 30, 2016
LICENSE.AMAZON The AWS Mobile SDK for iOS 2.4.0. Apr 19, 2016
LICENSE.APACHE The AWS Mobile SDK for iOS 2.4.0. Apr 19, 2016
NOTICE The AWS Mobile SDK for iOS 2.4.13. Nov 30, 2016
README.md The AWS Mobile SDK for iOS 2.6.26. Aug 3, 2018

README.md

AWS Mobile SDK for iOS

Release CocoaPods Carthage compatible Twitter Follow

Setting Up

To get started with the AWS SDK for iOS, check out the AWS Mobile Developer Guide for iOS. You can set up the SDK and start building a new project, or you integrate the SDK in an existing project. You can also run the samples to get a sense of how the SDK works.

To use the AWS SDK for iOS, you will need the following installed on your development machine:

  • Xcode 7 or later
  • iOS 8 or later

At the AWS GitHub repo, you can check out the SDK source code.

Include the SDK for iOS in an Existing Application

The samples included with the SDK for iOS are standalone projects that are already set up for you. You can also integrate the SDK for iOS with your own existing project. There are three ways to import the AWS Mobile SDK for iOS into your project:

You should use one of these three ways to import the AWS Mobile SDK but not multiple. Importing the SDK in multiple ways loads duplicate copies of the SDK into the project and causes compiler errors.

CocoaPods

  1. The AWS Mobile SDK for iOS is available through CocoaPods. If you have not installed CocoaPods, install CocoaPods by running the command:

     $ gem install cocoapods
     $ pod setup
    

    Depending on your system settings, you may have to use sudo for installing cocoapods as follows:

     $ sudo gem install cocoapods
     $ pod setup
    
  2. In your project directory (the directory where your *.xcodeproj file is), create a plain text file named Podfile (without any file extension) and add the lines below. Replace YourTarget with your actual target name.

     source 'https://github.com/CocoaPods/Specs.git'
     
     platform :ios, '8.0'
     use_frameworks!
     
     target :'YourTarget' do
         pod 'AWSAutoScaling'
         pod 'AWSCloudWatch'
         pod 'AWSCognito'
         pod 'AWSCognitoIdentityProvider'
         pod 'AWSDynamoDB'
         pod 'AWSEC2'
         pod 'AWSElasticLoadBalancing'
         pod 'AWSIoT'
         pod 'AWSKinesis'
         pod 'AWSLambda'
         pod 'AWSMachineLearning'
         pod 'AWSMobileAnalytics'
         pod 'AWSS3'
         pod 'AWSSES'
         pod 'AWSSimpleDB'
         pod 'AWSSNS'
         pod 'AWSSQS'
     end
    

    image

  3. Then run the following command:

     $ pod install
    
  4. Open up *.xcworkspace with Xcode and start using the SDK.

    image

    Note: Do NOT use *.xcodeproj. If you open up a project file instead of a workspace, you receive an error:

     ld: library not found for -lPods-AWSCore
     clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

Carthage

  1. Install the latest version of Carthage.

  2. Add the following to your Cartfile:

     github "aws/aws-sdk-ios"
    
  3. Then run the following command:

     $ carthage update
    
  4. With your project open in Xcode, select your Target. Under General tab, find Embedded Binaries and then click the + button.

  5. Click the Add Other... button, navigate to the AWS<#ServiceName#>.framework files under Carthage > Build > iOS and select them. Do not check the Destination: Copy items if needed checkbox when prompted.

    • AWSCore.framework
    • AWSAutoScaling.framework
    • AWSCloudWatch.framework
    • AWSCognito.framework
    • AWSCognitoIdentityProvider.framework
    • AWSDynamoDB.framework
    • AWSEC2.framework
    • AWSElasticLoadBalancing.framework
    • AWSIoT.framework
    • AWSKinesis.framework
    • AWSLambda.framework
    • AWSMachineLearning.framework
    • AWSMobileAnalytics.framework
    • AWSS3.framework
    • AWSSES.framework
    • AWSSimpleDB.framework
    • AWSSNS.framework
    • AWSSQS.framework
  6. Under the Build Phases tab in your Target, click the + button on the top left and then select New Run Script Phase. Then setup the build phase as follows. Make sure this phase is below the Embed Frameworks phase.

     Shell /bin/sh
     
     bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/AWSCore.framework/strip-frameworks.sh"
     
     Show environment variables in build log: Checked
     Run script only when installing: Not checked
     
     Input Files: Empty
     Output Files: Empty
    

Frameworks

  1. Download the SDK from our AWS Mobile SDK page. The SDK is stored in a compressed file archive named aws-ios-sdk-#.#.# (where #.#.# represents the version number, so for version 2.5.0, the filename is aws-ios-sdk-2.5.0).

  2. With your project open in Xcode, select your Target. Under General tab, find Embedded Binaries and then click the + button.

  3. Click the Add Other... button, navigate to the AWS<#ServiceName#>.framework files and select them. Check the Destination: Copy items if needed checkbox when prompted.

    • AWSCore.framework
    • AWSAutoScaling.framework
    • AWSCloudWatch.framework
    • AWSCognito.framework
    • AWSCognitoIdentityProvider.framework
    • AWSDynamoDB.framework
    • AWSEC2.framework
    • AWSElasticLoadBalancing.framework
    • AWSIoT.framework
    • AWSKinesis.framework
    • AWSLambda.framework
    • AWSMachineLearning.framework
    • AWSMobileAnalytics.framework
    • AWSS3.framework
    • AWSSES.framework
    • AWSSimpleDB.framework
    • AWSSNS.framework
    • AWSSQS.framework
  4. Under the Buid Phases tab in your Target, click the + button on the top left and then select New Run Script Phase. Then setup the build phase as follows. Make sure this phase is below the Embed Frameworks phase.

     Shell /bin/sh
     
     bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/AWSCore.framework/strip-frameworks.sh"
     
     Show environment variables in build log: Checked
     Run script only when installing: Not checked
     
     Input Files: Empty
     Output Files: Empty
    

Update the SDK to a Newer Version

When we release a new version of the SDK, you can pick up the changes as described below.

CocoaPods

  1. Run the following command in your project directory. CocoaPods automatically picks up the new changes.

     $ pod update
    

    Note: If your pod is having an issue, you can delete Podfile.lock and Pods/ then run pod install to cleanly install the SDK.

    image

Carthage

  1. Run the following command in your project directory. Carthage automatically picks up the new changes.

     $ carthage update
    

Frameworks

  1. In Xcode select the following frameworks in Project Navigator and hit delete on your keyboard. Then select Move to Trash:

    • AWSCore.framework
    • AWSAutoScaling.framework
    • AWSCloudWatch.framework
    • AWSCognito.framework
    • AWSCognitoIdentityProvider.framework
    • AWSDynamoDB.framework
    • AWSEC2.framework
    • AWSElasticLoadBalancing.framework
    • AWSIoT.framework
    • AWSKinesis.framework
    • AWSLambda.framework
    • AWSMachineLearning.framework
    • AWSMobileAnalytics.framework
    • AWSS3.framework
    • AWSSES.framework
    • AWSSimpleDB.framework
    • AWSSNS.framework
    • AWSSQS.framework
  2. Follow the installation process above to include the new version of the SDK.

Preparing your apps for iOS 9

The release of iOS 9 includes changes that might impact how your apps interact with some AWS services. If you compile your apps with Apple’s iOS 9 SDK (or Xcode 7), Apple’s App Transport Security (ATS) feature may affect the ability of apps to connect to certain AWS service endpoints. In order to ensure affected apps continue to successfully connect to AWS endpoints, you’ll need to configure them to interact properly with Apple’s ATS by adding these properties to your Info.plist file:

<key>NSAppTransportSecurity</key>
<dict>
        <key>NSExceptionDomains</key>
        <dict>
        <key>amazonaws.com</key>
        <dict>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.0</string>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
                <key>NSIncludesSubdomains</key>
                <true/>
        </dict>
        <key>amazonaws.com.cn</key>
        <dict>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.0</string>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
                <key>NSIncludesSubdomains</key>
                <true/>
        </dict>
        </dict>
</dict>

For more information, see Preparing Your Apps for iOS 9.

Getting Started with Swift

  1. Import the AWSCore header in the application delegate.

    import AWSCore
  2. Create a default service configuration by adding the following code snippet in the application:didFinishLaunchingWithOptions: application delegate method.

    let credentialsProvider = AWSCognitoCredentialsProvider(
        regionType: CognitoRegionType,
        identityPoolId: CognitoIdentityPoolId)
    let configuration = AWSServiceConfiguration(
        region: DefaultServiceRegionType,
        credentialsProvider: credentialsProvider)
    AWSServiceManager.default().defaultServiceConfiguration = configuration
  3. In Swift file you want to use the SDK, import the appropriate headers for the services you are using. The header file import convention is import AWSServiceName, as in the following examples:

    import AWSS3
    import AWSDynamoDB
    import AWSSQS
    import AWSSNS
    import AWSCognito
  4. Make a call to the AWS services.

    let dynamoDB = AWSDynamoDB.default()
    let listTableInput = AWSDynamoDBListTablesInput()
    dynamoDB.listTables(listTableInput!).continueWith { (task:AWSTask<AWSDynamoDBListTablesOutput>) -> Any? in
        if let error = task.error as? NSError {
        print("Error occurred: \(error)")
            return nil
        }
    
        let listTablesOutput = task.result
    
        for tableName in listTablesOutput!.tableNames! {
            print("\(tableName)")
        }
    
        return nil
    }

Note: Most of the service client classes have a singleton method to get a default client. The naming convention is + defaultSERVICENAME (e.g. + defaultDynamoDB in the above code snippet). This singleton method creates a service client with defaultServiceConfiguration, which you set up in step 5, and maintains a strong reference to the client.

Getting Started with Objective-C

  1. Import the AWSCore header in the application delegate.

    @import AWSCore;
  2. Create a default service configuration by adding the following code snippet in the application:didFinishLaunchingWithOptions: application delegate method.

    AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:CognitoRegionType
                                                                                                    identityPoolId:CognitoIdentityPoolId];
    AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:DefaultServiceRegionType
                                                                         credentialsProvider:credentialsProvider];
    AWSServiceManager.defaultServiceManager.defaultServiceConfiguration = configuration;
  3. Import the appropriate headers for the services you are using. The header file import convention is @import AWSServiceName;, as in the following examples:

    @import AWSS3;
    @import AWSDynamoDB;
    @import AWSSQS;
    @import AWSSNS;
    @import AWSCognito;
  4. Make a call to the AWS services.

    AWSS3TransferManager *transferManager = [AWSS3TransferManager defaultS3TransferManager];
    AWSS3TransferManagerUploadRequest *uploadRequest = [AWSS3TransferManagerUploadRequest new];
    uploadRequest.bucket = yourBucket;
    uploadRequest.key = yourKey;
    uploadRequest.body = yourDataURL;
    uploadRequest.contentLength = [NSNumber numberWithUnsignedLongLong:fileSize];
    
    [[transferManager upload:uploadRequest] continueWithBlock:^id(AWSTask *task) {
        // Do something with the response
        return nil;
    }];

Note: Most of the service client classes have a singleton method to get a default client. The naming convention is + defaultSERVICENAME (e.g. + defaultS3TransferManager in the above code snippet). This singleton method creates a service client with defaultServiceConfiguration, which you set up in step 5, and maintains a strong reference to the client.

AWSTask

With native AWSTask support in the SDK for iOS, you can chain async requests instead of nesting them. It makes the logic cleaner, while keeping the code more readable. Read Working with AWSTask to learn how to use AWSTask.

Logging

As of version 2.5.4 of this SDK, logging utilizes CocoaLumberjack, a flexible, fast, open source logging framework. It supports many capabilities including the ability to set logging level per output target, for instance, concise messages logged to the console and verbose messages to a log file.

CocoaLumberjack logging levels are additive such that when the level is set to verbose, all messages from the levels below verbose are logged. It is also possible to set custom logging to meet your needs. For more information, see CocoaLumberjack

Changing Log Levels

Swift

AWSDDLog.sharedInstance.logLevel = .verbose

The following logging level options are available:

  • .off
  • .error
  • .warning
  • .info
  • .debug
  • .verbose

Objective-C

[AWSDDLog sharedInstance].logLevel = AWSDDLogLevelVerbose;

The following logging level options are available:

  • AWSDDLogLevelOff
  • AWSDDLogLevelError
  • AWSDDLogLevelWarning
  • AWSDDLogLevelInfo
  • AWSDDLogLevelDebug
  • AWSDDLogLevelVerbose

We recommend setting the log level to Off before publishing to the Apple App Store.

Targeting Log Output

CocoaLumberjack can direct logs to file or used as a framework that integrates with the Xcode console.

To initialize logging to files, use the following code:

Swift

let fileLogger: AWSDDFileLogger = AWSDDFileLogger() // File Logger
fileLogger.rollingFrequency = TimeInterval(60*60*24)  // 24 hours
fileLogger.logFileManager.maximumNumberOfLogFiles = 7
AWSDDLog.add(fileLogger)

Objective-C

AWSDDFileLogger *fileLogger = [[AWSDDFileLogger alloc] init]; // File Logger
fileLogger.rollingFrequency = 60 * 60 * 24; // 24 hour rolling
fileLogger.logFileManager.maximumNumberOfLogFiles = 7;
[AWSDDLog addLogger:fileLogger];

To initialize logging to your Xcode console, use the following code:

Swift

AWSDDLog.add(AWSDDTTYLogger.sharedInstance()) // TTY = Xcode console

Objective-C

[AWSDDLog addLogger:[AWSDDTTYLogger sharedInstance]]; // TTY = Xcode console

Sample Apps

The AWS SDK for iOS includes sample apps that demonstrate common use cases.

Cognito Your User Pools Sample (Swift, Objective-C)

This sample demonstrates how sign up and sign in a user to display an authenticated portion of your app.

Cognito Sync Sample (Swift, Objective-C)

This sample demonstrates how to securely manage and sync your mobile app data and create unique identities via login providers including Facebook, Google, and Login with Amazon.

AWS Services Demonstrated:

DynamoDB Object Mapper Sample (Swift, Objective-C)

This sample demonstrates how to insert / update / delete / query items using DynamoDB Object Mapper.

AWS Services Demonstrated:

S3 Transfer Manager Sample (Swift, Objective-C)

This sample demonstrates how to upload / download multiple files simultaneously using S3 Transfer Manager. It also shows how to pause, resume, and cancel file upload / download.

AWS Services Demonstrated:

S3 Transfer Utility Sample (Swift, Objective-C)

This sample demonstrates how to use the Amazon S3 PreSigned URL Builder to download / upload files in background.

AWS Services Demonstrated:

SNS Mobile Push and Mobile Analytics Sample (Swift, Objective-C)

This sample demonstrates how to set up Amazon SNS Mobile Push and record events using Amazon Mobile Analytics.

AWS Services Demonstrated:

IoT Sample (Swift)

This sample demonstrates how to publish and subscribe to data using AWS IoT.

AWS Services Demonstrated:

IoT Temperature Control Sample (Swift)

This sample demonstrates accessing device shadows using Cognito authentication; it works in conjunction with the Temperature Control Example Program in the AWS IoT JavaScript SDK for Embedded Devices.

AWS Services Demonstrated:

Install the Reference Documentation in Xcode

The AWS Mobile SDK for iOS zip file includes documentation in the DocSets format that you can view within Xcode. The easiest way to install the documentation is to use the Mac OS X terminal.

  1. Open the Mac OS X terminal and go to the directory containing the expanded archive. For example:

     $ cd ~/Downloads/aws-ios-sdk-2.6.0
    

    Note: Remember to replace 2.6.0 in the example above with the actual version number of the AWS SDK for iOS that you downloaded.

  2. Create a directory called ~/Library/Developer/Shared/Documentation/DocSets:

     $ mkdir -p ~/Library/Developer/Shared/Documentation/DocSets
    
  3. Copy (or move) Documentation/com.amazon.aws.ios.docset from the SDK installation files to the directory you created in the previous step:

     $ mv Documentation/com.amazon.aws.ios.docset ~/Library/Developer/Shared/Documentation/DocSets/
    
  4. If Xcode was running during this procedure, restart Xcode. To browse the documentation, go to Help, click Documentation and API Reference, and select AWS Mobile SDK for iOS v2.6.0 Documentation (where '2.6.0' is the appropriate version number).

Talk to Us

Visit our GitHub Issues to leave feedback and to connect with other users of the SDK.

Author

Amazon Web Services

License

See the LICENSE file for more info.