Having trouble using CloudKit.
I used this code:
let publicDatabase = CKContainer(identifier: "iCloud.***.XXXX").database(with: .public)
With the correct container instead of "XX" and enabled these capabilities:
- Background modes: remote notifications enabled
- iCloud: CloudKit enabled
Note this is not the default container - I had to create a new one because the default one is loading incorrectly in the dashboard - "Error loading container details.").
App is not recording records to public iCloud database.
Please help, I am new to Swift and Xcode.
Here is some debugging (edited to make it shorter):
0..> test_useLegacySavePolicy:YES archivingUtilities:<PFCloudKitArchivingUtilities: 0x..0>
storeOptions: {
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
NSPersistentCloudKitContainerOptionsKey = "<NSPersistentCloudKitContainerOptions: 0x2..30>";
NSPersistentHistoryTrackingKey = 1;
NSPersistentStoreMirroringOptionsKey = {
NSPersistentStoreMirroringDelegateOptionKey = "<NSCloudKitMirroringDelegate: 0x2...c0>";
};
}
CoreData: debug: CoreData+CloudKit: <NSCloudKitMirroringDelegate: 0x2...>: Observing store: <NSSQLCore: 0x1...0>
CoreData: CloudKit: CoreData+CloudKit: ...<NSCloudKitMirroringDelegate: 0x2....c0>: Successfully enqueued setup request.
CoreData: CloudKit: CoreData+CloudKit: ....<NSCloudKitMirroringDelegate: 0x2...0>: Checking for pending requests.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest]_block_invoke(2941): <NSCloudKitMirroringDelegate: 0x....6c0>: Executing: <NSCloudKitMirroringDelegateSetupRequest: 0x...7a80>
2022-04-19 11:10:09..00 [Snapshotting] Snapshotting a view (0x10600e400, UIKeyboardImpl) that is not in a visible window requires afterScreenUpdates:YES.
CoreData: debug: CoreData+CloudKit: ...Skipping migration for 'ANSCKDATABASEMETADATA' because it already has a column named 'ZLASTFETCHDATE'
...
CoreData: CloudKit: CoreData+CloudKit: -[PFCloudKitSetupAssistant _checkUserIdentity:]_block_invoke(1235): <PFCloudKitSetupAssistant: 0x28...>: CKIdentity record matches store: <CKRecordID: 0x280...; recordName=_17385bb3..., zoneID=_defaultZone:defaultOwner>
2022-04-19 11:10:10.130670-0400 error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(1106): <NSCloudKitMirroringDelegate: 0x2833256c0>: Failed to set up CloudKit integration for store: <NSSQLCore: 0x104....610>
<CKError 0x2807902a0: "Partial Failure" (2/1011); "Failed to modify some record zones"; uuid = E88D-A....3D7-B4; container ID = "iCloud.XXXX"; partial errors: {
com.apple.coredata.cloudkit.zone:defaultOwner = <CKError 0x280797a80: "Permission Failure" (10/2007); server message = "Invalid bundle ID for container"; op = 5F3....3571; uuid = E8810E9D-23....3D7-C9....8A7...B4>
}>