Learn how to implement the Adobe Experience Platform Mobile SDK in a mobile app.
In this lesson, you will:
In a mobile app implementation, the terms “extensions” and “SDKs” are nearly interchangeable.
If you aren’t familiar with CocoaPods, please review the official getting started guide.
Install is usually a simple sudo command:
sudo gem install cocoapods
Once you have CocoaPods installed, open the Podfile.
Update the file to include the following pods:
pod 'AEPCore', '~> 3'
pod 'AEPEdge', '~> 1'
pod 'AEPUserProfile', '~> 3'
pod 'AEPAssurance', '~> 3'
pod 'AEPServices', '~> 3'
pod 'AEPEdgeConsent', '~> 1'
pod 'AEPLifecycle', '~>3'
pod 'AEPMessaging', '~>1'
pod 'AEPEdgeIdentity', '~>1'
pod 'AEPSignal', '~>3'
AEPMessaging
is only required if you plan to implement push messaging using Adobe Journey Optimizer. Please read the tutorial on implementing push messaging with Adobe Journey Optimizer for more information.
After saving the changes to your Podfile, navigate to the folder with your project and run the pod install
command to install your changes.
If you get the “No Podfile found in the project directory.” error, your terminal is in the wrong folder. Navigate to the folder with the Podfile you updated and try again.
If you want to upgrade to the latest version, run the pod update
command.
If you are not able to use CocoaPods in your own apps, you can learn about other supported implementations in the GitHub project.
To build CocoaPods, open Luma.xcworkspace
, and select Product, followed by Clean Build Folder.
You may need to set Build Active Architecture Only to No. To do this, select the Pods project from the project navigator, select Build Settings, and set the Build Active Architecture to No.
You can now build and run the project.
The Luma project was built with Xcode v12.5 on an M1 chipset and runs on the iOS simulator. If you are using a different setup, you may need to change your build settings to reflect your architecture.
If your build was not successful, try reverting the Build Active Architecture > Debug setting back to Yes.
Simulator configuration “iPod touch (7th generation)” was used while authoring this tutorial.
In each of the .swift
files, add the following imports. Start by adding to AppDelegate.swift
.
import AEPUserProfile
import AEPAssurance
import AEPEdge
import AEPCore
import AEPEdgeIdentity
import AEPEdgeConsent
import AEPLifecycle
import AEPMessaging //Optional, used for AJO push messaging
import AEPSignal
import AEPServices
In the AppDelegate.swift
file, add the following code to didFinishLaunchingWithOptions
. Replace currentAppId with the Development Environment File ID value that you retrieved from tags in the previous lesson.
let currentAppId = "b5cbd1a1220e/bae66382cce8/launch-88492c6dcb6e-development"
let extensions = [Edge.self, Assurance.self, Lifecycle.self, UserProfile.self, Consent.self, AEPEdgeIdentity.Identity.self, Messaging.self]
MobileCore.setLogLevel(.trace)
MobileCore.registerExtensions(extensions, {
MobileCore.configureWith(appId: currentAppId)
})
Messaging.self
is only required if you plan to implement push messaging via Adobe Journey Optimizer as described here.
The above code does the following:
In a production app, you must switch AppId based on the current environment (dev/stag/prod).
Next: Set up Assurance
Thank you for investing your time in learning about Adobe Experience Platform Mobile SDK. If you have questions, want to share general feedback, or have suggestions on future content, please share them on this Experience League Community discussion post