Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You can poll whether audio input is available using the AVAudioSession singleton class by checking the
inputIsAvailable class
property:
AVAudioSession *audioSession = [AVAudioSession sharedInstance]; BOOL audioAvailable = audioSession.inputIsAvailable;
The AVAudioSession class is
part of the AVFoundation.Framework. You’ll also need to
import the header:
#import <AVFoundation/AVFoundation.h>
You can also be notified of any changes in the availability of audio input (e.g., a second-generation iPod touch user has plugged in headphones with microphone capabilities). First, nominate your class as a delegate:
audioSession.delegate = self;
Declare it as implementing the AVAudioSessionDelegate protocol in the
declaration: