I'm showing video in a collection view cell of an IGListKit powered list. This is the cell:
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!)!)
}
}
And as soon as I start playing the video (it does play!) and scrolling the list a little, I constantly get this error:
2020-06-04 14:44:01.171138-0400 App[90104:5433754] [framework] CUICatalog: Invalid asset name supplied: '(null)'
Setting a breakpoint on runtime issues doesn't shed much light:
Any ideas?
I can't believe I didn't test this. But the error does indeed only happen on the Simulator. On-device it's fine. Solved.
Update: Ran into the same issue again. Maybe I never actually solved it in the first place? It's been too long to know for certain. But to solve the error
Invalid asset name supplied: '(null)'
You can find the answer here:
This is caused by setting the selected image field on a tab bar item in the storyboard. Clearing this field clears the error.