Migrate to Adobe Experience Platform 3.x SDKs for iOS
This Mobile SDK version for iOS supports a minimum iOS version of 10.0 and a tvOS version of 10.0.
SDK versions
Extension | Version |
---|---|
Migrate from ACP-prefixed SDKs for iOS
If you have implemented Objective-C versions (ACP-prefixed SDK libraries, 2.x or lower), then this guide will help you understand the steps required to migrate your implementation to the Swift versions (AEP-prefixed 3.x SDK libraries). In summary, you'll need to:
- Switch imported libraries from ACP-prefix to AEP-prefix libraries
- Update SDK initialization
- Update outdated API references
Switch imported libraries
At this time, the following ACP-prefix libraries may be switched out with their respective AEP-prefix SDK libraries. See instructions on proceeding further if you have manually imported SDK libraries , if you used CocoaPods to manage SDK dependencies, or you used Swift Package Manager.
In addition to ACPCore
being replaced with AEPCore
, you will also need to explicitly import AEPLifecycle
, AEPIdentity
, and AEPSignal
libraries to ensure there is no disruption in SDK behavior.
Objective-C (ACP-prefix) | Swift (AEP-prefix) |
---|---|
ACPCore | AEPCore/AEPLifecycle/AEPIdentity/AEPSignal |
ACPUserProfile | AEPUserProfile |
ACPAnalytics | AEPAnalytics |
ACPAudience | AEPAudience |
ACPTarget | AEPTarget |
ACPMedia | AEPMedia |
ACPPlaces | AEPPlaces |
AEPAssurance (1.x) | AEPAssurance (3.x) |
ACPCampaign | AEPCampaign |
ACPCampaignClassic | AEPCampaignClassic |
Manual library import
If you are manually importing SDK libraries, ensure you identify all currently used ACP-prefix libraries, remove them from your project, and switch them over to AEP-prefix libraries.
CocoaPods
If you are using CocoaPods to manage your Adobe Experience Platform Mobile SDK dependencies, the following example shows you how to switch ACP-prefix libraries to AEP-prefix libraries in your Podfile
.
Copied to your clipboard# replace ACPCore with AEPCore, AEPLifecycle, AEPIdentity and AEPSignal# pod 'ACPCore'pod 'AEPCore', '~> 3.0'pod 'AEPLifecycle', '~> 3.0'pod 'AEPIdentity', '~> 3.0'pod 'AEPSignal', '~> 3.0'# replace ACPUserProfile with AEPUserProfile# pod 'ACPUserProfile'pod 'AEPUserProfile', '~> 3.0'
Save the Podfile
, and run pod repo update
to update your local CocoaPods repository.
Once the previous command is complete, run pod install
or pod update
to update the application dependencies.
Swift Package Manager
If you are using Swift Package Manger (SPM) for managing your app dependencies, you can now include the AEP-prefixed libraries either through Xcode UI, or by declaring them as dependencies in the Package.swift project file. For more details, follow the guide for managing dependencies using Swift Package Manager.
Update SDK initialization
After you have imported the new Swift-based AEP-prefix libraries, you'll need to update SDK initialization code as described below. With Swift, the MobileCore.start()
API is no longer required. The SDK has simplified initialization and registration of extensions by providing the MobileCore.registerExtensions()
API. After the given extensions have been registered, the SDK will be initialized and the completion block will be executed. Code which used to reside in the start() block will now reside in the MobileCore.registerExtensions()
completion block.
The following code snippets show the new and correct initialization code required for the Swift-based, AEP-prefix SDK libraries.
Copied to your clipboard// AppDelegate.swiftimport AEPCoreimport AEPIdentityimport AEPLifecycleimport AEPSignalimport AEPUserProfilefunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {let appState = application.applicationStateMobileCore.registerExtensions([Signal.self, Lifecycle.self, UserProfile.self, Identity.self], {MobileCore.configureWith(appId: "<your_environment_file_id>")if appState != .background {// only start lifecycle if the application is not in the backgroundMobileCore.lifecycleStart(additionalContextData: ["contextDataKey": "contextDataVal"])}})...}
Copied to your clipboard@import AEPCore;@import AEPSignal;@import AEPLifecycle;@import AEPIdentity;@import AEPUserProfile;@import AEPServices;...// AppDelegate.m- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {const UIApplicationState appState = application.applicationState;[AEPMobileCore setLogLevel: AEPLogLevelDebug];[AEPMobileCore registerExtensions:@[AEPMobileSignal.class, AEPMobileLifecycle.class, AEPMobileUserProfile.class, AEPMobileIdentity.class] completion:^{[AEPMobileCore configureWithAppId: @"<your_environment_file_id>"];if (appState != UIApplicationStateBackground) {// only start lifecycle if the application is not in the background[AEPMobileCore lifecycleStart:@{@"contextDataKey": @"contextDataVal"}];}}];...}
Copied to your clipboard// AppDelegate.swiftimport AEPCoreimport AEPIdentityimport AEPLifecycleimport AEPSignalimport AEPUserProfilefunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {let appState = application.applicationStateMobileCore.registerExtensions([Signal.self, Lifecycle.self, UserProfile.self, Identity.self], {MobileCore.configureWith(appId: "<your_environment_file_id>")if appState != .background {// only start lifecycle if the application is not in the backgroundMobileCore.lifecycleStart(additionalContextData: ["contextDataKey": "contextDataVal"])}})...}
Copied to your clipboard@import AEPCore;@import AEPSignal;@import AEPLifecycle;@import AEPIdentity;@import AEPUserProfile;@import AEPServices;...// AppDelegate.m- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {const UIApplicationState appState = application.applicationState;[AEPMobileCore setLogLevel: AEPLogLevelDebug];[AEPMobileCore registerExtensions:@[AEPMobileSignal.class, AEPMobileLifecycle.class, AEPMobileUserProfile.class, AEPMobileIdentity.class] completion:^{[AEPMobileCore configureWithAppId: @"<your_environment_file_id>"];if (appState != UIApplicationStateBackground) {// only start lifecycle if the application is not in the background[AEPMobileCore lifecycleStart:@{@"contextDataKey": @"contextDataVal"}];}}];...}
Update outdated API references
Finally, you'll need to scan through your current implementation and replace ACP-prefix API calls to the new Swift-based, AEP-prefix libraries. A quick find and replace should do the trick. Detailed API changes by extension may be found at the links below.
SDK Component & Extensions | Migration API Reference |
---|---|
Core | |
Identity | |
Lifecycle | |
Signal | |
Profile | |
Adobe Experience Platform Assurance | |
Adobe Experience Platform Places Service | |
Adobe Analytics | |
Adobe Analytics - Media Analytics for Audio & Video | |
Adobe Audience | |
Adobe Experience Platform Target | |
Adobe Experience Platform Campaign | |
Adobe Experience Platform Campaign Classic |