【发布时间】:2017-01-19 17:04:08
【问题描述】:
我将我的项目升级到 Swift 3 并遇到了这个错误:
let cellDescriptor = cellDescriptors[(indexPath as NSIndexPath).section][indexOfVisibleRow] as! [String: AnyObject]
我在这一行遇到错误:
Type 'Any' has no subscript members
我该如何解决这个问题?我不知道该怎么做。我尝试将第一部分转换为 NSDictionary,然后它告诉我 IndexPath 类型的 indexPath 无法转换为 NSIndexPath。
【问题讨论】:
-
cellDescriptors 是什么类型的?它没有将其识别为数组。
-
向我们提供有关 cellDescriptors 的更多详细信息。编译器可能无法推断出第二种类型,因为您使用了两次下标。
标签: ios arrays swift nsdictionary nsindexpath