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 'AEPIdentity', '~> 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 via Adobe Journey Optimizer as described here.
Save the Podfile.
Navigate to the folder with your project run the following command: pod install
You should get output that looks something like this:
If you are getting an error “No Podfile found in the project directory.” then 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 minor versions, use the command:
pod update
If you are not able to use CocoaPods in your own apps, you can learn about other supported implementations in the github project.
Open Luma.xcworkspace
.
From the Xcode menu, select Product > Clean Build Folder.
You’ll likely need to set Build Active Architecture Only to No.
Build and run.
The Luma project was built with Xcode v12.5 on a M1 chipset and run on the iOS simulator. If you are using a different setup, you might have 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 AEPIdentity
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, AEPIdentity.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