I'm attempting to create a Swift/SwiftUI app that will run on iOS/iPadOS that uses CloudKit to syncronize data between devices. I have created the App in Xcode.
In the Apps Signing & Capabilities tab, I have:
- Ensured that the Bundle Identifier is valid
- Added the iCloud capability
- Created the Container and checked it
- Validated that the Container was created in the CloudKit Dashbaord
- Added the Backgrouind Modes capability
- Checked the Remote notifications option
I have modified/validated AppDelegate.swift:
- Validated that it is using NSPersistentCloudKitContainer
- Added container.viewContext.automaticallyMergesChangesFromParent to true
- Added container.viewContext.mergePolicy to NSMergeByPropertyObjectTrumpMergePolicy
When I load the App, I get a series of errors reported related to CloudKit NSCloudKitMirroringExportRequest. These errors are shown below. I am able to create records, but can see they are only stored locally and do not get synced to the CloudKit Dashboard - interestingly enough, the schema has been created in CloudKit Dashboard - so I know some level of connection has been made.
I appreciate any insight that someone can give me to resolve this and allow my data to sync properly.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedExportWithLabel:activity:completionHandler:]_block_invoke(2174): <NSCloudKitMirroringDelegate: 0x600003ef0c60> - Finished automatic export - ExportActivity - with result: <NSCloudKitMirroringResult: 0x60000096cc40> success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringExportRequest: 0x6000007545a0> B79831CF-9C04-4BB0-90B7-974EB38D2A25' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringExportRequest: 0x6000007545a0> B79831CF-9C04-4BB0-90B7-974EB38D2A25' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'.}
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate finishedAutomatedRequestWithResult:](2119): Finished request '<NSCloudKitMirroringExportRequest: 0x6000007545a0> B79831CF-9C04-4BB0-90B7-974EB38D2A25' with result: <NSCloudKitMirroringResult: 0x60000096cc40> success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringExportRequest: 0x6000007545a0> B79831CF-9C04-4BB0-90B7-974EB38D2A25' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringExportRequest: 0x6000007545a0> B79831CF-9C04-4BB0-90B7-974EB38D2A25' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'.}
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _enqueueRequest:]_block_invoke(714): <NSCloudKitMirroringDelegate: 0x600003ef0c60>: enqueuing request: <NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _enqueueRequest:]_block_invoke_2(724): Failed to enqueue request: <NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644
Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'.}
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _scheduleAutomatedImportWithLabel:activity:completionHandler:]_block_invoke(2150): <NSCloudKitMirroringDelegate: 0x600003ef0c60> - Finished automatic import - ImportActivity - with result: <NSCloudKitMirroringResult: 0x60000096f0c0> success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'.}
CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate finishedAutomatedRequestWithResult:](2119): Finished request '<NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644' with result: <NSCloudKitMirroringResult: 0x60000096f0c0> success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringImportRequest: 0x6000007a7450> D59C4B33-4075-4A43-AEF0-88EDD466D644' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'.}