1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

KVO for AVAudioPlayer not working.

Discussion in 'iPhone/iPad Programming' started by Avicenna, May 8, 2011.

  1. macrumors member

    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:

    [audioPlayer addObserver:self forKeyPath:@"currentTime" options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld) context:nil];
    - (void)observeValueForKeyPath:(NSString *)keyPath
                            change:(NSDictionary *)change
                           context:(void *)context {
        NSLog(@"%@", change);
  2. macrumors 65816


    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.

Share This Page