Swift 3 Type'Any'没有下标成员

use*_*331 9 ios swift swift3

我刚刚将我的项目转换为Swift 3我在这里有这行代码:

let type = self.data[indexPath.row]["Type"] as? String
Run Code Online (Sandbox Code Playgroud)

但现在我收到这个错误:

Type 'Any' has no subscript members
Run Code Online (Sandbox Code Playgroud)

为什么我会收到此错误并修复它?

ego*_*dan 16

let type = (self.data[indexPath.row] as? [String : String])?["Type"]
Run Code Online (Sandbox Code Playgroud)

你需要转换self.data[indexPath.row]成字典.