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

Reply
 
Thread Tools Search this Thread Display Modes
Old May 8, 2011, 10:46 PM   #1
Avicenna
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:

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.
Avicenna is offline   0 Reply With Quote
Old May 8, 2011, 11:24 PM   #2
jiminaus
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

Reply
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 09:20 PM
KVO Question. DavidBlack Mac Programming 8 Aug 12, 2013 03:04 PM
Music and SFX with AVAudioPlayer and SystemSounds thedollarhunter iPhone/iPad Programming 1 Oct 3, 2012 04:36 PM
AVAudioPlayer breaking video recording? lunadiviner iPhone/iPad Programming 0 Aug 2, 2012 04:03 PM
AVAudioPlayer is giving me hard time programming my iPhone app. zaxonus iPhone/iPad Programming 0 Jun 19, 2012 10:21 AM

Forum Jump

All times are GMT -5. The time now is 09:37 PM.

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

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