Swift, AVAudioRecorder: Error 317: ca_debug_string: inPropertyData == NULL

后端 未结 2 774
轻奢々
轻奢々 2021-02-06 07:41

I know that there are threads where this error message appears but they do not really supply an answer to the problem, this is why I decided open up another thread and ask again

相关标签:
2条回答
  • 2021-02-06 08:00

    I had the same issue. It works if you add another "audioRecorder.record()" line. You might want to do an audioRecorder.isRecording to check if it is recording inside an if statement. If it is recording then don't do anything, if it isn't then re-run that line.

    0 讨论(0)
  • 2021-02-06 08:10

    Your session.setCategory is outdated and has to be renamed:

    Incorrect:

    try! session.setCategory(AVAudioSessionCategoryPlayAndRecord, with:AVAudioSessionCategoryOptions.defaultToSpeaker)
    

    Correct:

    try! session.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.default, options: AVAudioSession.CategoryOptions.defaultToSpeaker)
    
    0 讨论(0)
提交回复
热议问题