AWS Mobile Blog

The AWS Mobile SDK for iOS 2.1.x – Split Frameworks

by Yosuke Matsuda | on | Permalink | Comments |  Share

The previous version of the SDK included only two frameworks, AWSiOSSDKv2.framework and AWSCognitoSync.framework. For Amazon Cognito Sync, you import AWSCognitoSync.framework, and for all other AWS services, you import AWSiOSSDKv2.framework. These frameworks do not require the -ObjC linker flag, and we recommended not using that flag. If your app depends on third-party libraries that require the -ObjC flag, we recommend using -force_load instead to load the libraries in order to minimize the binary size impact on your app. However, some developers are already using the -ObjC flag in their production apps with many dependencies and do not want to change the Other Linker Flags to minimize the potential end-user impact of their app updates.

Split Frameworks

In order to minimize the app binary size impact on these developers and also to provide a clean, consistent methodology for importing, we have split the framework into the core and a framework per-service. Instead of AWSiOSSDKv2.framework and AWSCognitoSync.framework, the AWS Mobile SDK for iOS 2.1.1 includes the following frameworks:

Framework Dependencies
AWSCore.framework – contains the shared classes among all services and three service clients, Amazon Cognito Identity, Amazon Mobile Analytics, and Amazon STS Service models

  • cognito-identity-2014-06-30.json
  • mobileanalytics-2014-06-30.json
  • sts-2011-06-15.json

System libraries

  • libz.dylib
  • SystemConfiguration.framework

Third-party libraries

  • Bolts.framework (If your application uses the Facebook SDK, you may not need this framework, as it’s already included with the Facebook SDK.)
  • GZIP.framework
  • Mantle.framework
  • Reachability.framework
  • UICKeyChainStore.framework
  • XMLDictionary.framework
AWSAutoScaling.framework – contains an Auto Scaling client Service models

  • autoscaling-2011-01-01.json
AWSCloudWatch.framework – contains an Amazon CloudWatch client Service models

  • monitoring-2010-08-01.json
AWSDynamoDB.framework – contains an Amazon DynamoDB client Service models

  • dynamodb-2012-08-10.json
AWSEC2.framework – contains an Amazon EC2 client Service models

  • ec2-2014-06-15.json
AWSElasticLoadBalancing.framework – contains an Amazon Elastic Load Balancing client Service models

  • elasticloadbalancing-2012-06-01.json
AWSKinesis.framework – contains an Amazon Kinesis client Service models

  • kinesis-2013-12-02.json

System libraries

  • libsqlite3.dylib

Third-party libraries

  • FMDB.framework
  • TMCache.framework
AWSLambda.framework – contains an AWS Lambda client Service models

  • lambda-2015-03-31.json
AWSMachineLearning.framework – contains an Amazon Machine Learning client Service models

  • machinelearning-2014-12-12.json
AWSS3.framework – contains an Amazon S3 client Service models

  • s3-2006-03-01.json

Third-party libraries

  • TMCache.framework
AWSSES.framework – contains an Amazon SES client Service models

  • email-2010-12-01.json
AWSSimpleDB.framework – contains an Amazon SimpleDB client Service models

  • sdb-2009-04-15.json
AWSSNS.framework – contains an Amazon SNS client Service models

  • sns-2010-03-31.json
AWSSQS.framework – contains an Amazon SQS client Service models

  • sqs-2012-11-05.json
AWSCognito.framework – contains an Amazon Cognito Sync client Service models

  • cognito-sync-2014-06-30.json

System libraries

  • libsqlite3.dylib

Integrating the Frameworks

Note that you always need to import AWSCore.framework and its dependencies because it is shared among all services. If you want to use AWS services not included in the core, you need to include the framework for the service and its dependencies. For example, if you want to use Amazon Mobile Analytics, you need to import the following components into your Xcode project:

Framework Dependencies
AWSCore.framework Service models

  • cognito-identity-2014-06-30.json
  • mobileanalytics-2014-06-30.json
  • sts-2011-06-15.json

System libraries

  • libz.dylib
  • SystemConfiguration.framework

Third-party libraries

  • Bolts.framework
  • GZIP.framework
  • Mantle.framework
  • Reachability.framework
  • UICKeyChainStore.framework
  • XMLDictionary.framework

If you want to use Amazon Kinesis, you need to import:

Framework Dependencies
AWSCore.framework Service models

  • cognito-identity-2014-06-30.json
  • mobileanalytics-2014-06-30.json
  • sts-2011-06-15.json

System libraries

  • libz.dylib
  • SystemConfiguration.framework

Third-party libraries

  • Bolts.framework
  • GZIP.framework
  • Mantle.framework
  • Reachability.framework
  • UICKeyChainStore.framework
  • XMLDictionary.framework
AWSKinesis.framework Service models

  • kinesis-2013-12-02.json

System libraries

  • libsqlite3.dylib

Third-party libraries

  • FMDB.framework
  • TMCache.framework

Make sure to remove AWSiOSSDKv2.framework and AWSCognitoSync.framework from the previous version of the SDK when upgrading, or you may receive the duplicate symbol compiler error.

Integrating with CocoaPods

In order to align with the framework, we split our pods to the core and per-service pods:

pod 'AWSCore'
pod 'AWSAutoScaling'
pod 'AWSCloudWatch'
pod 'AWSDynamoDB'
pod 'AWSEC2'
pod 'AWSElasticLoadBalancing'
pod 'AWSKinesis'
pod 'AWSLambda'
pod 'AWSMachineLearning'
pod 'AWSS3'
pod 'AWSSES'
pod 'AWSSimpleDB'
pod 'AWSSNS'
pod 'AWSSQS'
pod 'AWSCognito'

If you want to use Amazon Mobile Analytics, you need to add:

pod 'AWSCore'

to your Podfile. If you want to use Amazon Kinesis, you need to add:

pod 'AWSKinesis'

You do not need to import AWSCore separately in order to use Amazon Kinesis because CocoaPods resolves the dependencies for you and imports AWSCore for you. The only exception to this rule is Amazon Cognito Sync. When using Amazon Cognito Sync, you need to add both AWSCore and AWSCognito to your Podfile:

pod 'AWSCore'
pod 'AWSCognito'

Make sure to remove AWSiOSSDKv2 and AWSCognitoSync from the previous version to minimize the app binary size.

Once you update your Podfile, you just need to call:

$ pod install

to import the new SDK.

Importing the SDK

The way you import the SDK into your file has been updated. With the previous version, you import the SDK as follows:

CocoaPods

#import "AWSCore.h"
#import "S3.h"
#import "DynamoDB.h"
#import "SQS.h"
#import "SNS.h"

Frameworks

#import <AWSiOSSDKv2/AWSCore.h>
#import <AWSiOSSDKv2/S3.h>
#import <AWSiOSSDKv2/DynamoDB.h>
#import <AWSiOSSDKv2/SQS.h>
#import <AWSiOSSDKv2/SNS.h>

With 2.1.x, you can import the SDK with #import <AWSServiceName/AWSServiceName.h> whether you use CocoaPods or frameworks:

#import <AWSCore/AWSCore.h>
#import <AWSS3/AWSS3.h>
#import <AWSDynamoDB/AWSDynamoDB.h>
#import <AWSSQS/AWSSQS.h>
#import <AWSSNS/AWSSNS.h>

We hope these changes allow our developers to reduce their app binary sizes and provide cleaner and more consistent APIs. For more details on how to import each component, see Set Up the SDK for iOS. If you encounter issues with the SDK, please let us know at GitHub issues or Mobile Development Discussion Forum.