Post

Replies

Boosts

Views

Activity

Reply to SwiftData iCloud sync breaks after disabling and re-enabling iCloud
@DTS Engineer is it possible to escalate this? It's still happening in macOS 15.1.1 and I created a simple starter project where the problem is reproducible. Need to run the app on iOS and macOS and after a few minutes of using the app (creating items on iPhone and Mac) the sync breaks: https://www.icloud.com/iclouddrive/0f3lh5CfIuaE5Tb54PC5-gycg#SequoiaSync2 the logs only show this failure that I mentioned above: Request '<NSCloudKitMirroringImportRequest> ... was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'.
23h
Reply to SwiftData iCloud sync breaks after disabling and re-enabling iCloud
Well, after a while the other Mac with macOS 15.0.1 stopped syncing too. So the original report is still valid and I can reproduce it on two Macs with 15.0.1 and two iOS devices with iOS 18.1 b7. There is a simple project attached to FB15455847 which fails to sync after disabling / enabling iCloud and adding new items from all devices. Going through sysdiagnose again and following the steps in the article up to Execute the import All previous steps look fine but when it comes to enqueuing the request: default … 14:14:15.841814 … YourCoolApp CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _enqueueRequest:]_block_invoke(1003): <NSCloudKitMirroringDelegate: …>: enqueuing request: <NSCloudKitMirroringImportRequest: …> 2D00459F-8C08-4E9A-BC44-FCE1CD29A550 the enqueue fails with this: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _enqueueRequest:]_block_invoke_2(1030): Failed to enqueue request: <NSCloudKitMirroringImportRequest: 0x600001108690> 7F8489DA-CBB1-47E7-AE6D-EF6F107B1E29 Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringImportRequest: 0x600001108690> 7F8489DA-CBB1-47E7-AE6D-EF6F107B1E29' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringImportRequest: 0x600001108690> 7F8489DA-CBB1-47E7-AE6D-EF6F107B1E29' was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'.} and then it just loops over trying to execute that NSCloudKitMirroringImportRequest and failing: Request '<NSCloudKitMirroringImportRequest> ... was cancelled because there is already a pending request of type 'NSCloudKitMirroringImportRequest'. and the import never happens.
Oct ’24
Reply to SwiftData iCloud sync breaks after disabling and re-enabling iCloud
UPDATE: After some time the sync fails again for no obvious reason and here is the error that appears in the console for a Mac app: CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate finishedAutomatedRequestWithResult:](3599): Finished request '<NSCloudKitMirroringExportRequest: 0x600002d8c140> EF99499F-210C-4DB0-98F9-C10563CBD3D9' with result: <NSCloudKitMirroringResult: 0x6000000bcb10> storeIdentifier: 01B8CAF5-154B-47B9-81CC-5850C07D2836 success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134417 "Request '<NSCloudKitMirroringExportRequest: 0x600002d8c140> EF99499F-210C-4DB0-98F9-C10563CBD3D9' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'." UserInfo={NSLocalizedFailureReason=Request '<NSCloudKitMirroringExportRequest: 0x600002d8c140> EF99499F-210C-4DB0-98F9-C10563CBD3D9' was cancelled because there is already a pending request of type 'NSCloudKitMirroringExportRequest'.} Is this a sync attempt that's being cancelled?
Oct ’24
Reply to SwiftData iCloud sync breaks after disabling and re-enabling iCloud
After following a combination of these steps I got the sync back, although I ended up creating a new CloudKit container too. What I did: removed the apps from all devices made sure the store was removed on Mac logged out of iCloud on Mac, logged back in and rebooted (I don't think I did reboot before) unchecked and rechecked 'Automatically manage signing' in Signing & Capabilities (also didn't do that before) added a new CloudKit container and verified that it's assigned to the correct App ID. I previously tried adding a new container, but without these other steps it didn't work. So looks like it was a local issue after all. I moved the project from one machine to another recently and probably that broke the sync somehow. The app was run from Xcode. Thanks for your help, @DTS Engineer!
Oct ’24
Reply to SwiftData iCloud sync breaks after disabling and re-enabling iCloud
Thanks for the suggestion, @DTS Engineer, I saved the sysdiagnose and filtered it to errors. This is using a basic example project from Xcode. I'm running it on iPhone and Mac and when saving items from iPhone I can see them appear in CloudKit database, but they don't get synced to the Mac. And these are 5 errors that are looping when the Mac is trying to sync (I assume): 1 error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(1242): <NSCloudKitMirroringDelegate: 0x60000377c000>: Failed to set up CloudKit integration for store: <NSSQLCore: 0x13dc04080> (URL: file:///Users/admin/Library/Containers/ca.maybelater.SequoiaSync2/Data/Library/Application%20Support/default.store) <CKError 0x60000064adf0: "Service Unavailable" (6/NSCocoaErrorDomain:4099); "Error connecting to CloudKit daemon. This could happen for many reasons, for example a daemon exit, a device reboot, a race with the connection inactivity monitor, invalid entitlements, and more. Check the logs around this time to investigate the cause of this error."; Retry after 5.0 seconds> 2 error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate recoverFromError:](2312): <NSCloudKitMirroringDelegate: 0x60000377c000> - Attempting recovery from error: <CKError 0x60000064adf0: "Service Unavailable" (6/NSCocoaErrorDomain:4099); "Error connecting to CloudKit daemon. This could happen for many reasons, for example a daemon exit, a device reboot, a race with the connection inactivity monitor, invalid entitlements, and more. Check the logs around this time to investigate the cause of this error."; Retry after 5.0 seconds> 3 Error retrieving daemon to get network transfer endpoint: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.cloudd was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.cloudd was invalidated: failed at lookup with error 159 - Sandbox restriction.} 4 Error getting network transfer endpoint: <CKError 0x600000600990: "Service Unavailable" (6/NSCocoaErrorDomain:4099); "Error connecting to CloudKit daemon. This could happen for many reasons, for example a daemon exit, a device reboot, a race with the connection inactivity monitor, invalid entitlements, and more. Check the logs around this time to investigate the cause of this error."; Retry after 5.0 seconds> 5 error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate resetAfterError:andKeepContainer:](612): <NSCloudKitMirroringDelegate: 0x60000377c000> - resetting internal state after error: <CKError 0x60000064adf0: "Service Unavailable" (6/NSCocoaErrorDomain:4099); "Error connecting to CloudKit daemon. This could happen for many reasons, for example a daemon exit, a device reboot, a race with the connection inactivity monitor, invalid entitlements, and more. Check the logs around this time to investigate the cause of this error."; Retry after 5.0 seconds> And then it goes back to 1 and repeats. Does it look like a specific device issue?
Oct ’24
Reply to Importing Data into SwiftData in the Background Using ModelActor and @Query
Thanks for your reply, @DTS Engineer, I'm not sure the issue is related to the timing as in my case the try modelContext.save() is called after each operation. Also the example in the other post seems to be dealing with synchronous operations, rather than async via ModelActor. Still trying to replicate the exact steps. All I can see that a @Relationship is removed somehow beween two models some time after saving via ModelActor (can see that in CloudKit console), but it works correctly in iOS 17.5
Aug ’24
Reply to Importing Data into SwiftData in the Background Using ModelActor and @Query
Yes, it seems something was fixed (using Beta 6 and Xcode 16 b5). In my case I could get rid of the previous workaround with Notification Center and I can see the changes reflecting in the views. However there are definitely new problems with saving models - in some cases it appears a model's @Relationship is not saved. Will try to recreate this in a test project. In the meantime, @DTS Engineer - any comments on the new changes? PS. it is really quite frustrating that there is no mention of SwiftData issues in any of the Release Notes although changes are evidently being made
Aug ’24