Mac Developer Library

Developer

AVFoundation Framework Reference AVAudioRecorderDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

AVAudioRecorderDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Swift

import AVFoundation

Objective-C

@import AVFoundation;

Availability


Available in OS X v10.7 and later.

The delegate of an AVAudioRecorder object must adopt the AVAudioRecorderDelegate protocol. All of the methods in this protocol are optional. They allow a delegate to respond to audio interruptions and audio decoding errors, and to the completion of a recording.

  • Called by the system when a recording is stopped or has finished due to reaching its time limit.

    Declaration

    Swift

    optional func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder!, successfully flag: Bool)

    Objective-C

    - (void)audioRecorderDidFinishRecording:(AVAudioRecorder *)recorder successfully:(BOOL)flag

    Parameters

    recorder

    The audio recorder that has finished recording.

    flag

    YEStrue on successful completion of recording; NOfalse if recording stopped because of an audio encoding error.

    Discussion

    This method is not called by the system if the audio recorder stopped due to an interruption.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.

  • Called when an audio recorder encounters an encoding error during recording.

    Declaration

    Swift

    optional func audioRecorderEncodeErrorDidOccur(_ recorder: AVAudioRecorder!, error error: NSError!)

    Objective-C

    - (void)audioRecorderEncodeErrorDidOccur:(AVAudioRecorder *)recorder error:(NSError *)error

    Parameters

    recorder

    The audio recorder that encountered the encoding error.

    error

    Returns, by-reference, a description of the error, if an error occurs.

    Import Statement

    Objective-C

    @import AVFoundation;

    Swift

    import AVFoundation

    Availability

    Available in OS X v10.7 and later.