【发布时间】:2019-03-21 07:07:03
【问题描述】:
我在 Collection 视图中编写以下代码确实选择了行,但是当我当时选择单元格时出现以下错误 Error_Image In simulator
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if collectionView == faQs_collectionview
{
let fileURL = videourls[indexPath.item]
let playerviewcontroller = AVPlayerViewController()
var playerview = AVPlayer()
playerview = AVPlayer(url: fileURL as URL)
playerviewcontroller.player = playerview
self.present(playerviewcontroller, animated: true){
playerviewcontroller.player?.play()
}
}else{
}
}
【问题讨论】:
-
检查您的视频文件网址格式是否正确
-
我的视频格式是 var videourls:[URL] = [URL(string: "youtube.com/…)! as URL, URL(string: "youtube.com/…)!, URL(string: "@ 987654324@)!, URL(string: "youtube.com/…)!, URL(string: "youtube.com/…