You need to initialize the audio session with:
AudioSessionInitialize (NULL, NULL, NULL, NULL);
in viewDidLoad
or similar.
However, it's generally a better idea to make use of the new AVAudioSession class if you're targeting iOS 6+, which handles that for you:
float volume = [AVAudioSession sharedInstance].outputVolume;