在xcode 8 beta 6中使用UITableView中的indexPath.row不会编译
问题描述:
我有一个UITableView,我可以在xcode 8 beta 5及更早版本中使用indexPath.row访问该行。当我编译测试应用程序6,它说在xcode 8 beta 6中使用UITableView中的indexPath.row不会编译
Cannot subscript a value of type 'inout[AggregatedEvents]' (aka 'inout Array<AggregatedEvents>')
一个例子是
participant?.Timestamp = String(self.items[indexPath.row].timestamp!)
的发行说明测试6没有提到关于这个,据我所看到的变化。 AggregatedEvents是一个结构体,参与者是AWS DynamoDB表。
答
我将indexPath.row中的值赋给了一个临时值,并将其赋给了结构体。这部分代码会与这些更改一起编译。原来在底部。
let participant = Participants() // Struct.
let p1: String = String(self.items[indexPath.row].timestamp!)
participant?.Timestamp = p1 as NSString
//participant?.Timestamp = String(self.items[indexPath.row].timestamp!)