无法在 swift 3 中转换 AnyHashable
cannot convert AnyHashable in swift 3
我有以下方法,写在swift中(在swift 3之前)。下面是方法
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [AnyHashable: Any]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它给出了 Use of undeclared type AnyHashable
的错误。我怎样才能将其转换为 swift 3. 我尝试了以下内容。
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [NSObject : AnyObject]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它消除了错误,但不知道它以同样的方式运行。希望您对此有所帮助。提前谢谢。
类型转换
喜欢
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
print("received a notification")
Branch.getInstance().handlePushNotification(launchOptions)
}
您可以从 branch in Git
获得更多信息
我有以下方法,写在swift中(在swift 3之前)。下面是方法
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [AnyHashable: Any]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它给出了 Use of undeclared type AnyHashable
的错误。我怎样才能将其转换为 swift 3. 我尝试了以下内容。
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [NSObject : AnyObject]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它消除了错误,但不知道它以同样的方式运行。希望您对此有所帮助。提前谢谢。
类型转换
喜欢
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
print("received a notification")
Branch.getInstance().handlePushNotification(launchOptions)
}
您可以从 branch in Git
获得更多信息