DESCRIPTION
I have an App use iCloud to save data.
The App had a CoreData ManagedObject 'Product', 'Product' Object had an attribute name 'count' and it is a Double Type.
I need to synchronises 'count' property across multiple devices.
for example:
I have a devices A、B.
A device set 'Product.count' = 100.
B device set 'Product.count' = 50.
I hope the 'Product.count' == 150 that results.
how to synchronises the 'Product.count' == 150 for multiple devices.
If I have more devices in future, How to get the latest 'Product.count' that it is correct result.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
public static func fetch(in context: NSManagedObjectContext, configurationBlock: (NSFetchRequest) -> () = { _ in }) -> [Self] {
let request = NSFetchRequest(entityName: Self.entityName)
configurationBlock(request)
return try! context.fetch(request)
}
context.fetch(request), 'fetch' function has error. Thread 24: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
Xcode Sanitizers and Runtime Issues
Core Data
My Code:
let op = CKModifyRecordsOperation(recordIDsToDelete:recordIDsToDelete)
op.modifyRecordsCompletionBlock = { _, deleteRecordIDs, error in
if error == nil {
print("successful delete deleteRecordIDS = \(deleteRecordIDs)")
} else {
print("delete error = \(error?.localizedDescription)")
}
}
op.database = CKContainer.default().privateCloudDatabase
op.qualityOfService = .userInitiated
CKContainer.default().privateCloudDatabase.add(op)
My problem is that CKRecord are not deleted once I reinstall the app: when I reinstall the app and try to delete a CloudKit record, the method is executed successfully (error is nil) but the records are still in CloudKit Dashboards.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
CloudKit
CloudKit Dashboard
CloudKit Console