There are many questions and answers on SO that say that [AVAudioSession sharedInstance].outputVolume is the only way to determine the volume of a device. But it does not seem to work correctly. outputVolume never changes, although this is correct when it is first installed (when the application starts).
Am I doing it wrong? I do not know what else to do by reading the value of outputVolume . My instincts would tell me that it was a mistake if it were not for the fact that other people seem to be doing it just fine. I also tested it on iOS 7 and 8, so this is not an iOS 8 bug. I reproduced the same thing in a small test project, so that nothing in my project bothers it.
Also: I know well the difference between ringer volume and sound volume. I changed both options, and the message volume still has not changed.
Here is the function that I used in my test project:
- (void)checkVolume { float volume = [AVAudioSession sharedInstance].outputVolume; NSLog(@"Volume: %f", volume); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ { [self checkVolume]; }); }
source share