I need to detect when the user presses the hardware volume keys, (App Store safe approach) I have tried a number of things with no luck. Do you know how to implement such functionality? At present I am registering for notifications, however they don't seem to get called. Here's my code:
AudioSessionInitialize(NULL, NULL, NULL, NULL);
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self
selector:@selector(volumeChanged:)
name:@"AVSystemController_SystemVolumeDidChangeNotification"
object:nil];
And the receiver method is:
-(void)volumeChanged:(NSNotification *)notification{
NSLog(@"YAY, VOLUME WAS CHANGED");}
Any tips would be greatly appreciated.