I used following code to detect system volume changed by users.
NotificationCenter.default.addObserver(self, selector: #selector(volumeChanged), name: NSNotification.Name(rawValue: "AVSystemController_SystemVolumeDidChangeNotification"), object: nil)
When I updated to iOS 15, I found that this code is not working, but for any previous versions of iOS it works.
I also used an addObserver
function, but that is ok.
Is this a iOS 15 bug and if so what can I do to fix it.
thanks :)
I hooked MPVolumeControllerSystemDataSource's method _systemVolumeDidChange and at iOS 15.0(at least beta2) the notification name has changed to SystemVolumeDidChange and here is the new notification structure:
{
AudioCategory = "Audio/Video";
Reason = ExplicitVolumeChange;
SequenceNumber = 1069;
Volume = 0;
}
There're two points to be noticed:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With