xcode: How to save audio file after recording audio using AVFoundation

后端 未结 3 1001
别跟我提以往
别跟我提以往 2021-02-02 04:29

I browsed through all kinds of post related to this topic but the answers just do not really help. I used this tutorial to implement recording of audio files and playback. What

相关标签:
3条回答
  • 2021-02-02 05:05

    FYI -- The "[recorder prepareToRecord]" method creates a fresh audio file, overwriting any previous recorded file.

    0 讨论(0)
  • 2021-02-02 05:09

    You need to stop recording in order to save the data to the file permanently:

    [recorder stop];
    
    0 讨论(0)
  • 2021-02-02 05:18

    The problem is that when you tell XCode (in the viewDidLoad method) to [recorder prepareToRecord]; it gets rid of the previously recorded audio file. Eliminate that piece of code in the "if" statement and your audio file WILL be saved when you exit and come back in to the app.

    0 讨论(0)
提交回复
热议问题