我有一个添加观察者的方法:
- (void) method { [currentPlayer addObserver:self forKeyPath:@"some" options:some context:some]; }
所有更改都以这些方法处理:
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
- (void) method { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,0),^{ [currentPlayer addObserver:self forKeyPath:@"some" options:some context:some]; }); }
这是否意味着 – (void)observeValueForKeyPath …将在DISPATCH_QUEUE_PRIORITY_HIGH中工作?
附:我希望KVO能够在DISPATCH_QUEUE_PRIORITY_HIGH中工作.
编辑:
我观察AVPlayer变量.如:
[currentPlayer addObserver:self forKeyPath:@"currentItem.loadedTimeRanges" options:NSKeyValueObservingOptionNew context:kTimeRangesKVO];
这些变量会自动更改.
每次调用“observeValueForKeyPath”时我都会检查队列,它仍然是dispatch_get_main_queue(),我不知道如何将其更改为其他队列.