ios - 我如何订阅共享数据库的更改?

标签 ios swift cloudkit

当我创建订阅时:

let options: CKSubscriptionOptions = [.firesOnRecordCreation, .firesOnRecordUpdate, .firesOnRecordDeletion]
let subscription = CKDatabaseSubscription(recordType: "Territory", predicate: NSPredicate(value: true), options: options)

并将其保存到我的共享数据库中:

sharedDatabase?.save(subscription) { _, _ in }

它仍然没有出现在我的 cloudkit 仪表板中。为什么?

enter image description here

对于私有(private)数据库,出现...

enter image description here

注册后,我需要知道更改了哪些记录以及更改的类型。

最佳答案

您必须创建一个自定义区域,使用CKDatabaseSubscription

在其中保存您的Territory 记录类型

Be aware that CKQuerySubscription is not supported in the shared database, and CKDatabaseSubscription currently only tracks the changes from custom zones in the private and shared database.

更多信息请访问 Technical Q&A QA1917

关于ios - 我如何订阅共享数据库的更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45710257/

相关文章:

ios - 在 childViewController 之间切换时无法删除 searchController

ios - 如何判断您的应用程序是使用 iCloud 架构开发还是生产

ios - 在应用程序内登录 iCloud

ios - 使用 SDK 4.0.1 的 Objective-C Facebook 登录

iOS 表格 View 仅在设备旋转时加载数据

ios - 另一个点接收到的 PeerID 对象与 MultipeerConnectivity Framework 中的原始对象不同

iphone - 链接到 yaml 框架时遇到问题

swift - 用户调整 AVPlayerView 大小时强制宽高比 - Swift OS X Cocoa

ios - 如何解析 IOS 中的小块 JSON 数据?

swift - 匹配 Swift 中全文搜索的所有标记