CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate recoverFromPartialError:forStore:inMonitor:]block_invoke(1943): <NSCloudKitMirroringDelegate: 0x282430000>: Found unknown error as part of a partial failure: <CKError 0x28112d500: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; uuid = ; container ID = "iCloud.Appname">
I tried creating a new container which worked for both the watch app and iOS app however I would like to use my original container since it has my old data
The error message typically indicates that your app ID isn't properly associated with your iCloud container, which can be a configuration issue on your side, or a bug on the system side.
To rule out the configuration issue, consider the following:
a. When creating a CloudKit container, use CKContainer(identifier:) to explicitly specifying the container ID. This avoids confusion in the case where your app uses multiple containers. If you use Core Data CloudKit, specify the container ID with NSPersistentCloudKitContainerOptions:
let cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: yourCloudKitContainerIdentifier)
b. Be sure that your app ID and CloudKit container are correctly associated with the following steps:
-
Log in Apple's Developer Portal with your account, go to the Certificates, Identifiers & Profiles page, and find the app ID of your app.
-
Click the app ID to navigate to the Capabilities page, make sure iCloud is check, then click Edit to navigate to the iCloud Container Assignment page.
-
Find your iCloud container on the page.
-
Make sure the container ID is checked, meaning that the container ID is associated with your App ID. Without the association, your app won't be able to access the container.
-
Refresh your provisioning profile. If you are using Xcode’s Automatically manage signing, uncheck the box, check it back, and then pick the right team so Xcode refreshes the provisioning profile. Otherwise, you need to manually create the provisioning profile, download it, and install it for your Xcode.
If the error is still there, try with a new CloudKit container. (You can't delete an iCloud container after creating it, but in this case, you might want to create one to help diagnose the issue.) If the error goes away after you simply switching to the new CloudKit container, you can confirm that the association between your app ID and the CloudKit container isn't established, even though the Portal shows it is.
You can now forget the problematic CloudKit container, and use the new one to continue your development.
If the problematic CloudKit container has been shipped, and hence you need to fix the issue, start with filing a feedback report with the following information:
- Your app ID.
- The CloudKit container ID that triggers the problem.
- The code that you use to specify the CloudKit container.
- The screenshots that show the association between the app ID and the CloudKit container.
- The fact that simply switching to a new container fixes the issue.
You can then contact Apple's Developer Technical Support with the feedback report ID so they can work with the CloudKit team to correctly associate your app ID and CloudKit container ID from the server side.