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

后端 未结 2 773
轻奢々
轻奢々 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: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)
    

提交回复
热议问题