I keep getting the error: An error occurred in <CKError 0x282313e40: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; op = D62C00D9FAAABB1F; uuid = B9BFD757-0AB0-4981-BB5A-5DDB845E7097; container ID = "iCloud.com.xxx.xx
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
let location = locations.last!
locationManager?.stopUpdatingLocation()//need?
let locationRecord = CKRecord(recordType: "location")
locationRecord.setObject(location, forKey: "location")
let container = CKContainer(identifier: "iCloud.com.XXX.XX")
let publicData = container.publicCloudDatabase
publicData.save(locationRecord, completionHandler: { record, error in
if let saveError = error {
print("An error occurred in (saveError)")
} else {
// Saved record
}
}
2
Answers
I was able to fix this by disconnecting container from the project in Xcode under capabilities, saving, then connecting again. I also redid the provisioning profile. I believe it is an apple problem since nothing was actually changed.
If you’re receiving a Bundle ID error while using CloudKit, it’s likely that the Bundle ID in your Xcode project doesn’t match the Bundle ID of your CloudKit container.
To fix this error, you should ensure that the Bundle ID in your Xcode project matches the Bundle ID of your CloudKit container. You can do this by going to the CloudKit dashboard, selecting your container, and making note of the Bundle ID listed under "Development Environment" or "Production Environment".
Then, in your Xcode project, make sure that the Bundle Identifier listed in the project settings matches the Bundle ID of your CloudKit container. You may also need to update the Bundle ID in any provisioning profiles you are using.
Once you’ve made sure that the Bundle IDs match, you should be able to use CloudKit without encountering this error.