Post

Replies

Boosts

Views

Activity

isTrashed on NSManagedObject
On the "Sync a Core Data Store with the CloudKit public database" talk from WWDC2020 Nick Gillet mentioned shortcomings of the public database in comparison with the private database and in particular how records are deleted in the public database. He also showed a way of handling deletions of records in the public database in order that they get propagated to all the users devices by setting the isTrashed property of an NSManagedObject. Unfortunately I can not find this property neither in the documentation nor in code, does this mean that the intention is here to have every developer add this property manually to every entity in the public database by themself? Or did I just miss it? I was using Xcode 12 and Xcode 12.2 beta
0
0
528
Oct ’20
Core Data errors when saving context after syncing from CloudKit
In my new SwiftUI app I am using NSPersistentCloudKitContainer API to persist my data and also share it between multiple different devices. I am always using viewContext to fetch or save records, also my Stack consists of two custom configurations where CloudKit is enabled. One for entities to be stored in the CK public database and one for records in the private database. This usually works just fine. I can save or delete records on one device and they appear on the other device. However in some situations, usually after I imported data on device A and use the same device to create a new record I get errors like this when saving context: Error Domain=NSCocoaErrorDomain Code=133020 "Could not merge changes." UserInfo={conflictList=(     "NSMergeConflict (0x28126df40) for NSManagedObject (0x28242eda0) with objectID '0xb76a5d0f17dd5aa9 <x-coredata://FA91F3DE-B508-4842-95E0-EF4346521007/Lift/p11>' with oldVersion = 33 and newVersion = 34 and old object snapshot = {\n    id = \"D1E2B253-723C-406C-8566-2307DA2D5C17\";\n    name = bench;\n} and new cached row = {\n    id = \"D1E2B253-723C-406C-8566-2307DA2D5C17\";\n    name = bench;\n}" ), NSExceptionOmitCallstacks=true} I have no idea why PersistentCloudKitContainer is not able to merge this as the data for both records is practically the same only the version is updated. Also I am assuming that PersistentCloudKitContainer has an automatic merge policy configured by default which is . I am using Xcode 12 with deployment target also iOS 14 What did I miss here? Any help is appreciated
3
0
1.7k
Sep ’20