我有以下方法,用swift编写(在swift 3之前)。以下是方法
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [AnyHashable: Any]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它给出了Use of undeclared type AnyHashable
的错误。我怎样才能把它转变为迅速3.我尝试了以下。
func application(application: UIApplication, didReceiveRemoteNotification launchOptions: [NSObject : AnyObject]) -> Void {
Branch.getInstance().handlePushNotification(launchOptions)
}
它删除了错误,但不知道它的行为方式相同。希望你对此有所帮助。提前完成。
答案 0 :(得分:8)
类型转换
喜欢
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
print("received a notification")
Branch.getInstance().handlePushNotification(launchOptions)
}
您可以从branch in Git
获取更多信息