我知道在cannot subscript a value of type [MPMediaItem]处以完全相同的方式提出了问题,但是我没有得到他的解决方案。

cell.textLabel!.text = allSongs![indexPath.row]


这就是我想要的。

allSongs像这样声明var allSongs = [MPMediaItem]?()

最佳答案

您可能想做一些链接:

 cell.textLabel!.text = allSongs![indexPath.row].valueForProperty(MPMediaItemPropertyTitle) as? String

10-05 21:35