My Goal: On app termination, set the devices' volume back to the volume when the app was started

EDIT: As my hair grows thin on this one, it is appearing that there may not be ANY possible way, on app termination only, to set the device volume back to the level it was when an app started. To me this is a possible oversight on the part of Apple. Why wouldn't Apple want my app to be a good camper that leaves their campsite the way they found it, there must be a way, please help...


I know that applicationWillTerminate is called when a user dismisses apps from their recents list. I do this all the time and leave regularly used apps in recents so I don't have to scroll through 9 pages of icons to find them. So, there is a reason to do what I am asking, in that function. This is when my music player should set the volume back to the volume the user had before my music app was started.


I have tried accessing my MPVolumeView both in the applicationWillTerminate of my AppDelegate.m and in a UIApplicationWillTerminateNotification event in my viewcontroller.m .


In neither case can I access the MPVolumeView that my users change the devices volume with during their use of the app and which is on a view in my mainviewcontroller.


I am not at all sure that using the MPVolumeView to set the apps volume, on termination, back to the volume at app start is the correct way to go.


Before I continue pulling my hair out trying to do this with MPVolumeView, is there a better way to acchieve my stated goal or can someone tell me how to do this with MPVolumeView?


If MPVolumeView is the only way to do this, I can share my failled attempts if needed.


EDIT: I also tried creating an AVAudioPlayer in applicationWillTerminate with no luck.. 😟


Thanks,