我刚刚将我的项目转换为 Swift 3 我在这里有这行代码:
let type = self.data[indexPath.row]["Type"] as? String
但现在我得到这个错误:
Type 'Any' has no subscript members
为什么我会收到此错误并修复它?
最佳答案
let type = (self.data[indexPath.row] as? [String : String])?["Type"]
您需要将 self.data[indexPath.row]
转换为字典。
关于ios - Swift 3 类型 'Any' 没有下标成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39778940/