Integration
Supported iOS Versions
The Marketing Cloud Personalization iOS SDK supports the following:
- iOS versions of 15.0 and higher (starting with SDK 1.5.1)
- Swift and Objective-C, with Module support
- Integration via Swift Package Manager (recommended), or direct/manual integration using static and dynamic XCFrameworks
- CocoaPods (legacy): SDK 1.5.1 is the last release published to CocoaPods
Minimum Version Change in SDK 1.5.1
SDK 1.5.1 raises the minimum supported iOS version from 12.0 to 15.0. For platform compatibility information, see Apple’s SDK and system requirements.
To adopt SDK 1.5.1, set the customer app’s deployment target to iOS 15.0 or later and update the SDK dependency. The SDK can no longer be used to deploy that app to iOS 12, 13, or 14. Apps that must continue supporting those versions cannot adopt this SDK release; the new scene-preview fixes are not available in 1.5.0.
Add Your App to Your Dataset
To add your app to your dataset in the Personalization UI, do the following.
Log in to the Personalization UI, and choose the desired dataset.
Note
For an initial integration, we recommend using a non-production dataset.
From the left-hand menu, choose Mobile > Native App Setup.
Note
If this feature is disabled for your dataset, contact the Personalization support team to enable it.
In the Platform drop-down menu, select iOS.
Enter an App Name.
Enter the exact Bundle ID for your app from Xcode. To retrieve the Bundle ID from Xcode, select the app Target, the General tab, and look under the first Identity section for Bundle Identifier.
Click Create New App.
Important
You can add up to 8 native apps to a single dataset. However, deleting an app doesn’t free up space for a new one.
Personalization supports the following modes of integration:
- Integration with Swift Package Manager (recommended)
- Direct or manual integration
- Integration with CocoaPods (legacy)
Integration with Swift Package Manager
The Personalization iOS SDK is available through Swift Package Manager as a static XCFramework, starting with SDK 1.5.1 (which requires iOS 15.0 or later). Add the package from the public repository:
https://github.com/salesforce-marketingcloud/marketingcloud-personalization-ios-sdk
To add the package in Xcode, do the following.
In Xcode, choose File > Add Package Dependencies.
Enter the package repository URL shown above.
Select a version rule, such as Up to Next Major Version starting at
1.5.1.Add the
Evergagelibrary to your app target.
To add the package in a Package.swift file instead, use the following.
dependencies: [
.package(url: "https://github.com/salesforce-marketingcloud/marketingcloud-personalization-ios-sdk", from: "1.5.1")
],
targets: [
.target(name: "YourApp", dependencies: [
.product(name: "Evergage", package: "marketingcloud-personalization-ios-sdk")
])
]
Note
The Swift Package Manager integration uses the static XCFramework. If you need the dynamic XCFramework (for example, for app extensions that share the framework), use the direct or manual integration.
Next, proceed to initialize and start the Personalization SDK.
Direct or Manual Integration
The Personalization iOS SDK is available as a static and dynamic XCFramework.
For a manual integration, do the following.
Extract the SDK zip file.
Open either the
staticordynamicfolder and locate theEvergage.xcframeworkfolder within.Note
We recommend using the
staticintegration.Drag the chosen
Evergage.xcframeworkfolder from a Finder window onto the left Project Navigator pane in your Xcode project.- If you already have a folder/location where all your other Frameworks are, drag it there alongside the others.
- In the resulting Add files popup window:
- Ensure Copy items if needed is checked. Some apps will be unable to build/archive without this step, reporting a
not founderror. - Ensure your app targets are checked.
- Click Finish.
- Ensure Copy items if needed is checked. Some apps will be unable to build/archive without this step, reporting a
Note
If you’re using the dynamic
Evergage.xcframework, ensure that it gets embedded alongside the app. For more information, see Troubleshooting Manual Integrations.Clean build products and rebuild your app.
Troubleshooting Manual Integrations
If you encounter build or runtime linking problems during manual integration, do the following to troubleshoot.
- In the Project navigator, click the root project or workspace
- For each applicable app target:
- Click the app target under Targets
- Click the General tab
- Scroll down to Frameworks, Libraries, and Embedded Content
- Verify whether
Evergage.xcframeworkappears as an entry, and for its Embed column:- If using the static framework, verify whether the Embed value has its initial/unchanged Do Not Embed setting
- If using the dynamic framework, ensure that the Embed value has either Embed Without Signing or Embed & Sign
- Click the Build Settings tab
- Check the Framework Search Paths setting contains a path to where
Evergage.xcframeworkwas copied/installed into your project. If this setting is missing or inaccurate you may see ‘not found’ errors upon building/archiving/running the app. - Check the Link Frameworks Automatically setting is YES. If you desire otherwise, under the General tab and Linked Frameworks and Libraries section, ensure the following have been added:
UIKit.frameworkSystemConfiguration.frameworkCoreGraphics.frameworkQuartzCore.frameworklibz.tbdUserNotifications.framework(can be Optional/weak-linked)
Next, proceed to initialize and start the Personalization SDK.
Integration with CocoaPods (Legacy)
Note
CocoaPods trunk is becoming read-only in December, so SDK 1.5.1 is the last release published to CocoaPods. Existing versions continue to resolve. For new integrations and for later SDK releases, use Swift Package Manager or the direct or manual integration.
The Personalization iOS SDK is available as a vendored XCFramework via CocoaPods version 1.10 and higher. The podspec is configured to use the static XCFramework. However, you can use the dynamic XCFramework with a slight podspec edit. To integrate via CocoaPods, add a dependency on the Evergage pod, as shown in the following example.
pod 'Evergage', '1.5.1'
Next, proceed to initialize and start the Personalization SDK.
Initialize and Start the Personalization SDK
For sample code in Objective-C and Swift to call in your UIApplicationDelegate -willFinishLaunchingWithOptions implementation to initialize and start the Personalization SDK, see the Evergage class documentation.
UIKit Scene Lifecycle
UIKit apps built with the iOS 27 SDK must adopt the scene-based lifecycle. Apps that
still use only the legacy UIApplicationDelegate lifecycle can fail to launch when
built with an SDK that enforces scene adoption; this is a build-SDK requirement,
not a statement that every app running on iOS 27 requires migration.
For migration guidance, see Apple’s
Transitioning to the UIKit scene-based life cycle.
SDK 1.5.1: Campaign Preview and Design Mode
Use SDK 1.5.1, which contains the scene URL-handling and alert fixes, for campaign preview/test URLs and design-mode connection in scene-based apps. In SDK 1.5.0, manual URL forwarding is ignored when swizzling is enabled, and the legacy alert implementation is incompatible with scenes. Migrating the app alone does not fix these preview flows. See Test URLs on Device for warm-launch, cold-launch, and SwiftUI forwarding examples. Scene URLs must be forwarded explicitly whether SDK swizzling is enabled or disabled.
Scene lifecycle adoption does not require enabling multiple windows. The examples below support one scene; full multi-window campaign routing is a separate feature.
This requirement does not change where you initialize Personalization. Continue to
start the SDK from UIApplicationDelegate -willFinishLaunchingWithOptions: so that
process-level initialization happens as early as possible. Configure the app’s UI in
a UIWindowSceneDelegate, and add a scene configuration to the app’s Info.plist.
For storyboard-based apps, the scene configuration resembles the following example.
Use SceneDelegate for an Objective-C class. For a Swift class,
replace that value with $(PRODUCT_MODULE_NAME).SceneDelegate.
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
UIKit can use the configuration directly from this manifest. If the app implements the configuration callback, return the same name as declared in the manifest.
Objective-C:
- (UISceneConfiguration *)application:(UIApplication *)application
configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession
options:(UISceneConnectionOptions *)options {
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration"
sessionRole:connectingSceneSession.role];
}
Swift:
func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions
) -> UISceneConfiguration {
UISceneConfiguration(
name: "Default Configuration",
sessionRole: connectingSceneSession.role
)
}
For apps that create their UI programmatically, create the UIWindow with the supplied
UIWindowScene in scene(_:willConnectTo:options:). Storyboard-based apps can let UIKit
create the window and root view controller from UISceneStoryboardFile.
With SDK 1.5.1’s iOS 15 minimum, these scene APIs are available throughout the supported deployment range. Scene-based apps receive URLs in their scene delegate; apps using the legacy app-delegate lifecycle on a supported iOS version should follow the legacy URL instructions in the Testing guide.
User Detail
You can use other methods in the Evergage class to add information about the user. In the startup example code, setting the [Evergage userId] provides Personalization with the user’s authenticated ID. If the user’s ID is unknown at startup, you could call this method later to then send the user’s ID with subsequent events.
Next
To know more about tracking events and actions and sending them to Personalization, see the Tracking Guide.