Posts

Post not yet marked as solved
1 Replies
1.3k Views
Hello,I have managed to get CoreData with CloudKit working with the new NSPersistentCloudKitContainer on the iOS version of my app and got it to automatically sync while the app is running. However, when I went to set things up on the watchOS app, I noticed that a sync will only occur if I force close and reopen the watch app.The following scenarios workUser has both the watchOS app and iOS app runningUser makes a change to the data on the watch appThe change is reflected on the iOS appUser has only the iOS app runningUser makes a change to the data on the iOS appThe user opens the watchOS app from terminatedThe changes are reflected on the watchOS appThe following scenario does not workUser has the watchOS app running and the iOS app runningUser makes a change to the data on the iOS appNo change every makes it through to the watchOS app, even after waiting a long timeOnly if I force close the app and restart does a sync occurIn the cases were a sync is successful I see the following logs correctly:CoreData: debug: CoreData+CloudKit: -[PFCloudKitImporterZoneChangedWorkItem newMirroringResultByApplyingAccumulatedChanges:]_block_invoke_2(243): <PFCloudKitImporterZoneChangedWorkItem: 0x16530fb0> {( "<CKRecordZoneID: 0x1656a920; zoneName=com.apple.coredata.cloudkit.zone, ownerName=__defaultOwner__>")} - Importing updated records:( "<CKRecord: 0x16526280; recordType=CD_LogEntry, values={\n \"CD_day\" = 15;\n \"CD_entityName\" = LogEntry;\n \"CD_glassesGoal\" = 8;\n \"CD_glassesLogged\" = 13;\n \"CD_lastModified\" = \"2019-09-15 18:56:08 +0000\";\n \"CD_month\" = 9;\n \"CD_year\" = 2019;\n}, recordChangeTag=7d, recordID=2180D6A3-ACFC-4421-8CAF-6EE288DAAC2E:(com.apple.coredata.cloudkit.zone:__defaultOwner__)>")Deleted RecordIDs:{}In the last scenario, however, I don't see any logs, it's completely quiet. I am sharing the same CoreData/CloudKit code in both the iOS and watchOS versions of the app. I am also using a NSFetchedResultsController<LogEntry> to make sure my UI stays up to date and it seems to be working on the iOS app but not the watchOS app. Not sure if there was some step that I had missed when setting up the watch extension.Any help would be appreciated.
Posted Last updated
.