一、老方案:
监听系统音量变化非常简单,只需要设置一个通知即可:AVSystemController_SystemVolumeDidChangeNotification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(volumeChanged:)
name:@"AVSystemController_SystemVolumeDidChangeNotification" object:nil];
然后实现volumeChanged:方法
- (void)volumeChanged:(NSNotification *)notification
{
if (![[[notification userInfo] objectForKey:@"AVSystemController_AudioVolumeChangeReasonNotificationParameter"] isEqualToString:@"ExplicitVolumeChange"]) {
return;
}