Team “57AWJ345M2” cannot enable iCloud Key-Value Storage for Bundle ID “com.marsgame.fg2”

When using Team “57AWJ345M2” and setting the project’s Bundle ID to “com.marsgame.fg2”, enabling the iCloud capability and checking Key-Value Storage results in the following error:"Provisioning profile "iOS Team Provisioning Profile: com.marsgame.fg2" doesn't match the entitlements file's value for the com.apple.developer.ubiquity-kvstore-identifier entitlement."

This issue does not occur if we use a different Team or a different Bundle ID.

The project was transferred from another Team to this new Team, and everything worked fine before the transfer.

Additionally, we have tried creating a brand new project, but as long as we use this same Team and this same Bundle ID, the error still occurs when enabling Key-Value Storage.

Answered by DTS Engineer in 874286022

If you transfer an app that uses iCloud key-value store (NSUbiquitousKeyValueStore), the transferred app should use the orignal store identifier, which by default is the bundle ID prefixed with the orignal team ID, so it still has the access to the existing data.

The orginal store identifier is embedded in the new provisioning profiles you create for the transferred app. What you need is to update your entitlements plist with the full KVS value in your provisioning profile. This is documented in in the “Apps using iCloud” section here.

In your case, is 57AWJ345M2 the new team ID? Using the new team ID as the prefix of the key-value store will lose the access to the orginal store. I believe that's why Xcode gives you the error.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

If you transfer an app that uses iCloud key-value store (NSUbiquitousKeyValueStore), the transferred app should use the orignal store identifier, which by default is the bundle ID prefixed with the orignal team ID, so it still has the access to the existing data.

The orginal store identifier is embedded in the new provisioning profiles you create for the transferred app. What you need is to update your entitlements plist with the full KVS value in your provisioning profile. This is documented in in the “Apps using iCloud” section here.

In your case, is 57AWJ345M2 the new team ID? Using the new team ID as the prefix of the key-value store will lose the access to the orginal store. I believe that's why Xcode gives you the error.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Thank you for your reply.

Our previous Team ID was H7837BUR8M. We tried changing the value of com.apple.developer.ubiquity-kvstore-identifier in the .entitlements file from $(TeamIdentifierPrefix)$(CFBundleIdentifier) to H7837BUR8M$(CFBundleIdentifier), but Xcode still reports the same error.

That's a surprise to me. Would you mind to try with the following steps and see if the error is still there?

  1. Confirm the app transfer process is successfully completed.

  2. Confirm your provisioning profile is updated. You can do so by uncheck the Automatically manage signing box in Xcode and then check it back, which has Xcode refresh the provisioning profile. If you manually manage your codesign, download the updated profile from Apple's membership portal.

  3. Find the provisioning profile for your app from ~/Library/Developer/Xcode/UserData/Provisioning Profiles/ (or ~/Library/MobileDevice/Provisioning Profiles/ if you are using earlier version Xcode). If you have multiple files in the folder, find the one that has App ID Name tied to your app ID.

  4. Open the provisioning profile with your favorite text editor, and try to find the identifier of the key-value store identifier. If everything goes well, the identifier should be there.

  5. In your Xcode project, update the value of the com.apple.developer.ubiquity-kvstore-identifier entitlement with the value in your provisioning profile.

I am super curious what you see with these steps.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Thank you very much. After inspecting the contents of the provisioning profile, I found that the actual value contains a “.” separator between the Team ID and the Bundle ID.

Team “57AWJ345M2” cannot enable iCloud Key-Value Storage for Bundle ID “com.marsgame.fg2”
 
 
Q