I'm trying to detect when the volume buttons are pressed in iOS 15 by following this answer: https://stackoverflow.com/a/68296203
How exactly can I receive this notification and where do I find MPVolumeControllerSystemDataSource
? It seems like this might be obvious (judging by the upvotes for the answer) but I just can't figure it out. Using this right now which is not working anymore on iOS 15:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(volumeChanged:) name:@"AVSystemController_SystemVolumeDidChangeNotification" object:nil];
How do I need to change the code to receive the notification on iOS 15?
PS: I'm aware that the documented way would be to use the outputVolume property instead, but for a few reasons I'd like to detect the volume button presses in this "incorrect" way.