You can use the MarketingCloudSDK to switch between Marketing Cloud business units. For example, you can switch business units to move from production tasks to debug tasks, or you can use one business unit for testing during development and another business unit for production releases.

The following code samples walk you through switching business units. For these instructions, you need the appid value that you used during application configuration.

Caution: Switching business units removes any MarketingCloudSDK data, such as contact key, tags, and attributes from the system. See the Preserve Configuration Information section.

  1. Issue sfmc_tearDown to the SDK.
  2. Execute a standard configure, as in applicationDidFinishLaunching.
  3. Set the delegate, if needed.
  4. Authorize the MarketingCloudSDK to use notifications.

Example: BU Switching

Preserve Configuration Information

To keep track of configuration information that would be lost during business unit switching, use a configuration file. The file, like in the following example, can contain multiple JSON dictionaries of configuration data, each with a unique appid and access token value from Marketing Cloud.

Example: Configuration File

Handle Multiple Configurations

To select from multiple configurations, use the index of your configuration when configuring the SDK using the configureWithURL:configuationIndex:error: method.

Example: Select Configuration