问题
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)
}
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.
回答1:
type conversion
do like
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
print("received a notification")
Branch.getInstance().handlePushNotification(launchOptions)
}
for more information you can get from branch in Git
来源:https://stackoverflow.com/questions/41013323/cannot-convert-anyhashable-in-swift-3