2016-12-07 81 views
-2

我有以下方法,它寫在swift(swift 3之前)。下面是方法不能轉換AnyHashable在迅速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) 
    } 

它消除了錯誤,但不知道它的行爲方式如同。希望你對此有所幫助。 thanx提前。

+0

顯示您handlePushNotification代碼 –

回答

8

類型轉換

enter image description here

不喜歡

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

} 

瞭解更多信息,你可以從branch in Git