无法在swift 3中转换AnyHashable

bil*_*ill -2 ios branch.io swift3

我有以下方法,用swift编写(在swift 3之前).以下是方法

func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [AnyHashable: Any]) -> Void {
    Branch.getInstance().handlePushNotification(launchOptions)
}
Run Code Online (Sandbox Code Playgroud)

它给出了错误Use of undeclared type AnyHashable.我怎么能把它转换成快速3.我尝试了以下.

 func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [NSObject : AnyObject]) -> Void {
        Branch.getInstance().handlePushNotification(launchOptions)
    }
Run Code Online (Sandbox Code Playgroud)

它删除了错误,但不知道它的行为方式相同.希望你对此有所帮助.提前.

Anb*_*hik 8

类型转换

在此输入图像描述

喜欢

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
print("received a notification")
   Branch.getInstance().handlePushNotification(launchOptions)

}
Run Code Online (Sandbox Code Playgroud)

有关更多信息,您可以从Git的分支机构获取