Front-End Web & Mobile
The AWS Mobile SDK for iOS 2.1.x – Split Frameworks
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
System libraries
Third-party libraries
|
AWSAutoScaling.framework – contains an Auto Scaling client |
Service models
|
AWSCloudWatch.framework – contains an Amazon CloudWatch client |
Service models
|
AWSDynamoDB.framework – contains an Amazon DynamoDB client |
Service models
|
AWSEC2.framework – contains an Amazon EC2 client |
Service models
|
AWSElasticLoadBalancing.framework – contains an Amazon Elastic Load Balancing client |
Service models
|
AWSKinesis.framework – contains an Amazon Kinesis client |
Service models
System libraries
Third-party libraries
|
AWSLambda.framework – contains an AWS Lambda client |
Service models
|
AWSMachineLearning.framework – contains an Amazon Machine Learning client |
Service models
|
AWSS3.framework – contains an Amazon S3 client |
Service models
Third-party libraries
|
AWSSES.framework – contains an Amazon SES client |
Service models
|
AWSSimpleDB.framework – contains an Amazon SimpleDB client |
Service models
|
AWSSNS.framework – contains an Amazon SNS client |
Service models
|
AWSSQS.framework – contains an Amazon SQS client |
Service models
|
AWSCognito.framework – contains an Amazon Cognito Sync client |
Service models
System libraries
|
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
System libraries
Third-party libraries
|
If you want to use Amazon Kinesis, you need to import:
Framework | Dependencies |
---|---|
AWSCore.framework |
Service models
System libraries
Third-party libraries
|
AWSKinesis.framework |
Service models
System libraries
Third-party libraries
|
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.