iOS Unity Cloud Build fails error: Provisioning profile doesn't match the entitlements file's value

Hello! My project needs to include iCloud capability but the build fails with this error:

Provisioning profile “MyPrivisioningProfile” doesn’t match the entitlements file’s value for the com.apple.developer.ubiquity-kvstore-identifier entitlement. (in target ‘Unity-iPhone’ from project ‘Unity-iPhone’)
Here’s the PostProcessBuild script:
```csharp
*#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
using UnityEngine;
using UnityEditor.Callbacks;
using UnityEditor;

public class IosPostProcessBuild : MonoBehaviour
{
[PostProcessBuild]
private static void OnPostprocessBuild(BuildTarget buildTarget, string path)
{
if (buildTarget == BuildTarget.iOS)
{
string projPath = path + “/Unity-iPhone.xcodeproj/project.pbxproj”;
ProjectCapabilityManager projCapability = new ProjectCapabilityManager(projPath, “Unity-iPhone/spingram.entitlements”, PBXProject.GetUnityTargetName()); //“Unity-iPhone/spingram.entitlements” //“Unity-iPhone”

        //projCapability.AddGameCenter();
        //string[] empty = null;
        projCapability.AddiCloud(true, false, new string[] {});
        projCapability.WriteToFile();
    }
}

}*
```

I’ve seen that error if the App ID Configuration on the developer site doesn’t have iCloud checked off. I think it can also happen if the com.apple.developer.ubiquity-kvstore-identifier is pointed at an invalid target. I’m currently working through a similar problem. AddiCloud sets a default value for com.apple.developer.ubiquity-kvstore-identifier and doesn’t have a parameter to specify a target.

Everything is right on the developer website. Previously I built with Xcode and iCloud did work.
Unfortunately I can’t use Xcode because of Kernel panic issue while archiving.

Do you have multiple entitlements files and the project is using the wrong one? I’ve seen that happen too.

@

Hey there! I’m having the same issue today, tried many different ways over the internet, still can’t solve this. Building via Xcode works fine but this happens every time via Cloud Build.

Did you find a solution to this problem?

Thanks,
Charles

Bump…

Got the same problem.
Anyone know of a solution?

You may be running into the issue described in this forum post about Xcode 10 and the new Xcode build system. It represents an issue with the new build system that matches the behavior in OP’s report. It suggests a custom Fastlane configuration is the best workaround for it.

Thanks!
Finally works…!