【发布时间】:2017-09-26 07:09:56
【问题描述】:
我已在 Xcode 9 中将我的代码更新为 swift 4。在此之前它运行良好。但是现在 AVplayer 在观察者面前崩溃了,下面是它崩溃的代码。
addObserver(self, forKeyPath: "player.currentItem.duration", options: [.new, .initial], context: &playerViewControllerKVOContext)
日志是
由于未捕获的异常而终止应用程序 'NSUnknownKeyException',原因:'[addObserver:forKeyPath:@“player.currentItem.duration”选项:5 context:0x10ff74ac8] 被发送到不符合 KVC 的对象 对于“播放器”属性。'
【问题讨论】:
-
感谢 Tushar Sharma 的编辑