Configure the SDK
The configuration example in this section uses the MarketingCloudSDK ConfigBuilder configuration method. This method is the most flexible way to use the Mobile App Messaging SDK.
All method names contain the prefix sfmc_. Using this prefix helps avoid namespace collisions between the external libraries it uses. For more information, see Apple Developer Documentation: Customizing Existing Classes.
Configure the SDK in your application using mamAppID, mamAccessToken, mamServerURL, and mamTenantId.
This example imports the SFMCSDK module, which is included automatically with the dependencies for the SDK. Never install this dependency manually (such as by using CocoaPods).
iOS Data Protection affects the SDK as described in this table.
| iOS Data Protection Level | SDK Behavior |
|---|---|
| No protection | SDK works in the foreground and background. |
| Complete until first user authentication | SDK works in the foreground and background after first unlock. |
| Complete unless open | SDK works in the foreground and background after first unlock. |
| Complete | SDK works only in the foreground after the device is unlocked. |