【发布时间】:2016-03-03 19:27:03
【问题描述】:
我知道在 cannot subscript a value of type [MPMediaItem] 以完全相同的方式提出了这个问题,但我没有得到他的解决方案。
cell.textLabel!.text = allSongs![indexPath.row]
这是我正在尝试的。
allSongs 是这样声明的 var allSongs = [MPMediaItem]?()
【问题讨论】:
-
您遇到什么错误?确保行小于数组的计数。
-
我的错误和标题“Cannot subscript a value of type [MPMediaItem]”一模一样,行是allSongs.count
-
您将
MPMediaItem分配给需要String的属性 -
如何将 MPMediaItem 转换为字符串? @丹
-
然后做
cell.textLabel!.text = allSongs![indexPath.row].title
标签: ios swift uitableview mpmediaitem