我正在IGListKit支持列表的集合视图单元中显示视频。这是单元格:
import AVKit
class ContentCell: UICollectionViewCell {
static var vc: UIViewController?
func setup() {
if media.fileType.starts(with: "video/") {
return setupVideo()
}
}
var videoVC: AVPlayerViewController?
func setupVideo() {
guard let vc = ContentCell.vc else {
return
}
guard let videoVC = videoVC else {
let videoVC = AVPlayerViewController()
self.videoVC = videoVC
vc.addChild(videoVC)
self.addSubview(videoVC.view)
setupVideo()
return
}
videoVC.view.frame = bounds
videoVC.player = AVPlayer(url: URL(string: media.originalSource!)!)
}
}
并且一旦我开始播放视频(它确实会播放!)并稍微滚动列表,就会不断出现此错误:
2020-06-04 14:44:01.171138-0400 App[90104:5433754] [framework] CUICatalog: Invalid asset name supplied: '(null)'
有什么想法吗?
我简直不敢相信我没有测试过。但是错误确实只发生在模拟器上。在设备上很好。解决。