iOS 11.4 setValue of MPVolumeView no longer working



In previous versions of our app we used code to do certain things when a user clicked up/down on their volume buttons.


After each click we would programtically reset the user’s volume to 0.5 so that we would be able to tell next time if it were an up/down click.

The code looked like this

        (MPVolumeView().subviews.filter{NSStringFromClass($0.classForCoder) == "MPVolumeSlider"}.first as? UISlider)?.setValue(0.5, animated: false)


Unfortunately this does not seem to successfully change the value in iOS 11.4 but I cannot find any reason as to why – and XCode is silent regarding this line. It does find the slider correctly, just does not actually change the volume. So when a user taps up 5x, for example, the volume is set to 1.0 and then does not doing anything.


Any help or insight on this would be awesome, it is very important for our app.



Powered by WPeMatico

You may also like...

Comments are closed.