user1406716
user1406716

Reputation: 9705

why is audioRecorderDidFinishRecording not getting called? Able to record and play audio successfully

In the code here, I am able to record audio and also play it back successfully no problem there.

Problem is that audioRecorderDidFinishRecording is never getting called. What am I missing?

func audioRecorderDidFinishRecording(recorder: AVAudioRecorder!, successfully flag: Bool) {
    println("Recording finished")
}

Upvotes: 1

Views: 1363

Answers (2)

prasad
prasad

Reputation: 196

You are assigning self to delegate even before it is created

audioRecorder?.delegate = self

audioPlayer?.delegate = self

prepareForRecording()

audioRecorder is created in prepareForRecording() function, audioRecorder is nil before that.

Assign self to delegate after it is created.

Upvotes: 1

AARON MCLEAN
AARON MCLEAN

Reputation: 31

Make sure to call audioRecorder.stop() first

Upvotes: 1

Related Questions