1

我正在学习用 swift2 编写的教程——现在我安装了 swift2.1。在 Swift 2.1 中,以下强制转换会引发错误

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

错误是

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

有人可以帮我解决这个问题吗?

4

1 回答 1

0

解决方案如下:

dictionaryOK = (dictionary as! NSDictionary as? Dictionary<String, AnyObject>)!
于 2015-10-29T12:08:30.753 回答