【发布时间】:2016-09-21 06:12:02
【问题描述】:
我已将 swift 2.3 升级到 swift 3,但出现此错误
对成员 'subscript' swift3 的模糊引用
这里是代码
var cellDescriptors: [[String:Any]]!
func loadCellDescriptors() {
if let path = Bundle.main.path(forResource: "ProfileDescriptor", ofType: "plist") {
cellDescriptors = NSMutableArray(contentsOfFile: path)
getIndicesOfVisibleRows()
tableView.reloadData()
}
}
if cellDescriptors[indexPath.section][indexOfTappedRow]["isExpanded"] as! Bool == false {
shouldExpandAndShowSubRows = true
}
我在这条线上遇到了错误
if cellDescriptors[indexPath.section][indexOfTappedRow]["isExpanded"] as! Bool == false
给我任何建议,我该如何解决这个问题
【问题讨论】:
-
感谢回复,但我已经尝试过了,但它不起作用
-
未解决得到错误
-
是但不工作
-
NSArray(contentsOfFile: Bundle.main.path(forResource: "CellDescriptor", ofType: "plist")!) as? [[[String: Any]]] ?? []是正确的 -
感谢您的帮助,它正在工作