2015-10-26 59 views
1

我正在編寫用swift2編寫的教程 - 現在我已經安裝了swift2.1。在雨燕2.1以下投拋出一個錯誤在swift2中將NSDictionary轉換爲字典

dictionaryOK = (dictionary as! NSDictionary as? Dictionary)! 

的錯誤是

Cannot assign value of type 'Dictionary<Key,Value>' to type 'NSDictionary' 

有人可以幫我解決這個問題?

回答

0

的solutuion如下:

dictionaryOK = (dictionary as! NSDictionary as? Dictionary<String, AnyObject>)! 
+0

爲什麼雙投?什麼類型是字典? – user3441734