【发布时间】:2017-01-06 00:15:24
【问题描述】:
背景
我正在尝试在我的应用委托中从application:didReceiveRemoteNotification:userInfo:fetchCompletionHandler 加载userInfo 字典。
然后我需要将 userInfo 从 [AnyHashable:Any] 转换为 [String:NSObject],这样我就可以在 CloudKit 的 CKNotification:fromRemoteNotificationDictionary 中使用它。
问题
当我这样做时:
let ui = userInfo as! [String : NSObject]
我得到错误:
'[AnyHashable:Any]' is not convertible to '[String:NSObject]'
有没有更好的方法将userInfo 转换为适当的类型,还是我走错了路?
【问题讨论】:
标签: notifications cloudkit swift3 ios10