Accessing .recordFields from CKQueryNotification Swift 2

筅森魡賤 提交于 2019-12-24 14:54:41

问题


I get the following error on didReceiveRemoteNotifications if I try to simply print this property, like:

let cloudKitNotification = CKNotification(fromRemoteNotificationDictionary:   userInfo as! [String : NSObject])     
if cloudKitNotification.notificationType == .Query {
      let queryNotification = cloudKitNotification as! CKQueryNotification
      print(queryNotification.recordFields)

Could not cast value of type '__NSCFDictionary' (0x273119c) to 'CKRecordValue' (0x2763090).

If I print the whole queryNotification, I can see the recordFields inside of it. I've spent the whole day trying to understand that. Any clues?

Xcode 7.3.1

来源:https://stackoverflow.com/questions/37059790/accessing-recordfields-from-ckquerynotification-swift-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!