Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread Display Modes
Old May 8, 2011, 09:46 PM   #1
macrumors member
Join Date: Jul 2009
KVO for AVAudioPlayer not working.

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);
Avicenna is offline   0 Reply With Quote
Old May 8, 2011, 10:24 PM   #2
macrumors 65816
Join Date: Dec 2010
Location: 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.
jiminaus is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPhone: iPhone 5 / iPad 3 with Airport Extreme and WPA2 not working, WPA working ManuCH iOS 6 7 Aug 13, 2013 08:20 PM
KVO Question. DavidBlack Mac Programming 8 Aug 12, 2013 02:04 PM
Music and SFX with AVAudioPlayer and SystemSounds thedollarhunter iPhone/iPad Programming 1 Oct 3, 2012 03:36 PM
AVAudioPlayer breaking video recording? lunadiviner iPhone/iPad Programming 0 Aug 2, 2012 03:03 PM
AVAudioPlayer is giving me hard time programming my iPhone app. zaxonus iPhone/iPad Programming 0 Jun 19, 2012 09:21 AM

Forum Jump

All times are GMT -5. The time now is 12:33 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2015, MacRumors.com, LLC