我正试图用swift链接一些带有强制转换的命令。有谁知道为什么会发生以下情况变量赋值部分工作正常,但如果我尝试将它们链接在一起,则会产生似乎无法修复的编译错误。
var tempArr = JSONDict["years"]! as [AnyObject]
var tempDict = tempArr[0] as Dictionary<String,AnyObject>
var tempString = tempDict["year"]! as String
var tempInt = tempString.toInt()
var year = (((JSONDict["years"]! as [AnyObject])[0] as Dictionary<String,AnyObject>)["year"] as String).toInt()
提前致谢!
答案 0 :(得分:0)
在!
["year"]
var year = (((JSONDict["years"]! as [AnyObject])[0] as Dictionary<String,AnyObject>)["year"]! as String).toInt()