0

I am using following code in viewdidload method.And app crashes when I Open app.Please let me know what I am doing wrong.Thanks in advance.

 recordingSession = AVAudioSession.sharedInstance()
    do {
        try recordingSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
        try recordingSession.setActive(true)
        recordingSession.requestRecordPermission() { [unowned self] allowed in
            DispatchQueue.main.async {
                if allowed {
                    self.loadRecordingUI()
                } else {
                    // failed to record!
                }
            }
        }
    } catch {
        // failed to record!
    }

1 Answers1

0

You have to add NSMicrophoneUsageDescription in your plist file to get the permission popup.

For the list of permissions check this SO answers

Community
  • 1
  • 1
Bluewings
  • 3,438
  • 3
  • 18
  • 31