无法在 swift 3 中转换 AnyHashable [英] cannot convert AnyHashable in swift 3
本文介绍了无法在 swift 3 中转换 AnyHashable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下方法,它是用 swift 编写的(在 swift 3 之前).下面是方法
I have following method, which written in swift (before swift 3). below is the method
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [AnyHashable: Any]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它给出了 Use of undeclared type AnyHashable
的错误.我如何将其转换为 swift 3.我尝试了以下操作.
it gives and error of Use of undeclared type AnyHashable
. how can I covert this to swift 3. I tried with following.
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [NSObject : AnyObject]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它消除了错误,但不知道它的行为方式是否相同.希望您对此有所帮助.提前谢谢.
it removes the error, but don't know it act like same way. hope your help with this. thanx in advance.
推荐答案
类型转换
喜欢
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
print("received a notification")
Branch.getInstance().handlePushNotification(launchOptions)
}
有关更多信息,您可以从 Git 分支
for more information you can get from branch in Git
这篇关于无法在 swift 3 中转换 AnyHashable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文