如何在swift中观察多个NSKeyObservingKeyValueoptions
self.avplayerItem.addObserver(self, forKeyPath: "status", options:[.Initial | .New], context: nil)
我收到类似
的错误错误
否' |'候选人产生预期的上下文结果类型' NSKeyValueObservingOptions'
答案 0 :(得分:6)
更改
self.avplayerItem.addObserver(self, forKeyPath: "status", options:[.Initial | .New], context: nil)
为:
self.avplayerItem.addObserver(self, forKeyPath: "status", options:[.Initial, .New], context: nil)