如何使用CKNotification?

How to Use CKNotification?

我想在 cloudkit

值发生变化时收到通知

这是我的代码:

let now = Date()
    let timeInterval:TimeInterval = now.timeIntervalSince1970
    let timeStamp = Int(timeInterval)
let publicDB = CKContainer.default().publicCloudDatabase
    let bookID = CKRecord.ID(recordName: "\(timeStamp)")
    let book = CKRecord(recordType: "Book", recordID: bookID)

我通过定期询问解决了这个问题。