Ara*_*ash 5 synchronization core-data zone cloudkit
在WWDC 2019期间,Apple推出NSPersistentCloudKitContainer了允许CoreData与CloudKit同步的技术。这是一个很棒的补充。在iOS 13中,Notes应用程序中还允许用户与另一个用户共享整个便笺“ FOLDER”。鉴于Apple使用CloudKit for Notes应用程序,我想创建类似的东西来了解它如何更好地工作。
com.apple.coredata.cloudkit.zone如果满足所有设置条件,Apple将创建区域并基本上将那里的所有数据同步到该区域。但是,当用户想要共享数据时,没有任何指南。根据WWDC的前一次演讲,共享将主要通过创建CUSTOM ZONE来实现。但是,新NSPersistentCloudKitContainer方法无法为CoreData中的每个实体更改区域。
我很高兴找到这些
open func record(for managedObjectID: NSManagedObjectID) -> CKRecord?
open func records(for managedObjectIDs: [NSManagedObjectID]) -> [NSManagedObjectID : CKRecord]
open func recordID(for managedObjectID: NSManagedObjectID) -> CKRecordID?
open func recordIDs(for managedObjectIDs: [NSManagedObjectID]) -> [NSManagedObjectID : CKRecordID]
Run Code Online (Sandbox Code Playgroud)
as they gave this impression that the container calls this methods to retrieve the CKRecord and hence a point to modify informations such as zone etc. but after the setup I realized when I add a new entity to my CoreData, these functions even though when overrides are not called.
My question in short is: how to take controll of how NSPersistentCloudKitContainer manages which record belongs to which zone other than com.apple.coredata.cloudkit.zone
| 归档时间: |
|
| 查看次数: |
299 次 |
| 最近记录: |