Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Avicenna

macrumors member
Original poster
Jul 16, 2009
89
0
Hi, I am trying to observe the "currentTime" property of AVAudioPlayer. But the method isn't even being called... I need it to set the position of a UISlider.. But it's not working. Here's the relevant code:

Code:
[audioPlayer addObserver:self forKeyPath:@"currentTime" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];


- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context {
    NSLog(@"%@", change);
}
Thanks.
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
According to the developer docs for AVAudioPlayer, it does not respond to any of the NSKeyValueObserving messages. Do you know if it's KVO compliant? If it's not, then you can't observe property changes on it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.