Troubleshoot Data Merge

For iOS applications upgraded from SDK versions 7.x to versions up to 8.0.6, the previous v7.x tags and attributes are retained on the device but not sent to the server. If an application doesn’t reset or regenerate tags and attributes, the device sends empty tags and attributes to the system.

The following sections walk through the requirements for merging datasets successfully.

Using SPM, upgrade to the latest version of the SDK for iOS and SFMCSDK for iOS.

You may encounter a build failure if the Swift compiler version used to build the SDK doesn’t match the version used by your current Xcode toolchain.

The build fails with this error:

To resolve this issue, follow these steps to reset your environment:

  1. Clear Derived Data.
  2. Remove the SDK dependencies from your project and then add them back again.
  3. Clean and Run.

The merging tool offers two options to merge attributes and tags: automatic merging and manual merging. In some scenarios, you can choose to defer or avoid merging the datasets. The merging tool defaults to an “opted out” state if you don’t implement either of the merging methods. In the opted out state, tags and attributes aren’t merged from the version 7.x dataset to your current application’s dataset.

The automatic merging option attempts to merge old data into the current dataset, with the current data taking precedence over data within the version 7.x dataset.

The following tables illustrate how automatic merging behaves and how data is merged.

in this tables, key:value pairs are denoted using : as the separator.

Attributes

Prior DatasetCurrent DatasetMerge Result
A:BemptyA:B
emptyA:BA:B
A:B, C:DA:EA:E, C:D
A:BA: clearedA: cleared

Tags

Prior DatasetCurrent DatasetMerge Result
SHIRTSemptySHIRTS
emptyPANTSPANTS
SHIRTSPANTSSHIRTS, PANTS
SHIRTSSHIRTS, PANTSSHIRTS, PANTS

The following code snippets show you how to configure the SDK to attempt an automatic merge.

To ensure the completion callback passed into setAutoMergePolicy is set before SDK initialization, place the following code snippets before SDK initialization.

The manual merge option enables you to receive both the prior data and the current data in a callback, providing the opportunity to choose what data ultimately ends up in the final dataset.

You can decide what attributes and tags are set in the current dataset. However, to set attributes and tags accordingly, you must retain the data until the SDK is initialized.

Access to the tags and attributes for versions 7.x and 8.x is provided before SDK initialization.

If you must run the merge tool again, you can attempt the merge multiple times.

Reattempting merges doesn’t roll back the current dataset but enables you to regain access to the data within the old version 7.x dataset.