我正在尝试使用CloudKit订阅推送通知.我收到这个错误:
<CKError 0x170c5b1e0: "Unknown Item" (11/2003); server message = "could not find required field fieldID="25""
let subscription = CKSubscription(recordType: "PlayerData",predicate: NSPredicate(format: "TRUEPREDICATE"),options: CKSubscriptionOptions.FiresOnRecordCreation) let notificationInfo = CKNotificationInfo() notificationInfo.shouldBadge = false subscription.notificationInfo = notificationInfo PublicDb.saveSubscription(subscription,completionHandler: { (returnedSubscription: CKSubscription!,error: NSError!) in println("\(error)") })
但我没有一个名为“fieldID”的字段,也没有在我的整个项目中对它有任何引用.我不知道25来自哪里.如果我更改记录类型和/或NSPredicate,它仍然会发生.@H_404_5@
我也试过设置这个,但没有@H_404_5@
notificationInfo.shouldSendContentAvailable = true
这曾经适合我,但现在我不能让它工作了.好像我的数据库在某个地方被破坏了.我尝试删除记录类型并重新创建但没有运气.@H_404_5@
解决方法
通过重置开发环境来修复它.希望同样的事情不会发生在prod上.