Responding to AVAudioRecorder Events
Like many API classes, AVAudioRecorder sends messages to a delegate. To respond to delegate actions from the AVAudioRecorder, your class must implement the AVAudioRecorderDelegate. Table 3 describes the methods that can be implemented.
|-(void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag||Called when the recorder finishes recording. This method will get passed a reference to the recorder and a bool value that is YES if it was successful.|
|-(void)audioRecorderEncodeErrorDidOccur:(AVAudioRecorder *)recordererror:(NSError *)error||Called when an error occurred during recording.|
|-(void)audioRecorderBeginInterruption:(AVAudioRecorder *)recorder||Called when the recording is interrupted. The most common interruption would be when the user gets an incoming call while recording.|
|-(void)audioRecorderEndInterruption:(AVAudioRecorder *)recorder||Called when the interruption ends. An example of this would be the using pressing ignore to an incoming call.|
As with most delegate classes, it is important to implement all of these methods in your class. This will ensure that your application will respond correctly in any circumstance.