ios7 - iOS 7: MPMusicPlayerController volume deprecated. How to change device volume now? -


mpmusicplayercontroller setvolume deprecated since ios 7

is there other way change system music volume? preferably without user interaction. important feature: increase volume automatically alarm clock appstore.

to answer question exactly: yes there other way change system volume without user interaction.

until recent times used think changing volume using mpvolumeview programmatically possible using private api. have verified, changing value of volumeslider , faking slider's touchup event works:

mpvolumeview* volumeview = [[mpvolumeview alloc] init];  //find volumeslider uislider* volumeviewslider = nil; (uiview *view in [volumeview subviews]){     if ([view.class.description isequaltostring:@"mpvolumeslider"]){         volumeviewslider = (uislider*)view;         break;     } }  [volumeviewslider setvalue:1.0f animated:yes]; [volumeviewslider sendactionsforcontrolevents:uicontroleventtouchupinside]; 

(when slider receives touchup event, invoke _commitvolumechange method on itself, change system volume)


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -