How do I know what items my object is key-value observing?
The only way I've been able to find out if I'm already observing is to try to remove the observation. If an exception is thrown, then I wasn't observing.
for (AVPlayerItem *item in itemsToRemove) {
@try{
[item removeObserver:self forKeyPath:@"status" context:(__bridge void *)(foo)];
}@catch(id anException){
//wasn't observing
}
}
EDIT: I'm considering using my own dictionary to track observation but that seems redundant since a KVO Dictionary does exist somewhere. Unfortunately there is no API access.