Integration
The Marketing Cloud Personalization iOS SDK supports the following:
- iOS versions of 12.0 and higher
- Swift and Objective-C, with Module support
- Integrations via Cocoapods or direct/manual integrations using static and dynamic XCFrameworks
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.
For an initial integration, we recommend using a non-production dataset.
-
From the left-hand menu, choose Mobile > Native App Setup.
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.
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 two modes of integration:
- Integration with CocoaPods
- 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.
Next, proceed to initialize and start the Personalization SDK.
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
static
ordynamic
folder and locate theEvergage.xcframework
folder within.We recommend using the
static
integration. -
Drag the chosen
Evergage.xcframework
folder 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 found
error. - 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
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.
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.xcframework
appears 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.xcframework
was 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.framework
SystemConfiguration.framework
CoreGraphics.framework
QuartzCore.framework
libz.tbd
UserNotifications.framework
(can be Optional/weak-linked)
Next, proceed to 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.
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.
To know more about tracking events and actions and sending them to Personalization, see the Tracking Guide.