tchvu3 / capacitor-voice-recorder

Capacitor plugin for voice recording
69 stars 57 forks source link

Unexpectedly found nil crash #18

Closed santekotturi closed 1 year ago

santekotturi commented 2 years ago

I've found this plugin fatally crashes when my phone is in an audio call and I try to record an audio. I've got everything wrapped in try catch blocks and it still fatally crashes the app.

Xcode throws an error here, something about trying to implicitly unwrap nil

    public func stopRecording() {
        do {
            audioRecorder.stop()
            try recordingSession.setActive(false)
            try recordingSession.setCategory(originalRecordingSessionCategory)
            originalRecordingSessionCategory = nil
            audioRecorder = nil
            recordingSession = nil
            status = CurrentRecordingStatus.NONE
        } catch {}
    }
tchvu3 commented 2 years ago

can you share the call stack??

karimBenBechir commented 1 year ago

Hello guys, Thank you very much for providing the plugin ! I have same issue here, when microphone is used by an other app, the flow is corrupted and it crashes the app returning "Unexpectedly found nil while implicitly unwrapping an Optional value". I've trying walkarounds, such as trycatch, check for ability to record via the "canDeviceVoiceRecord" method, catch "startRecording" and "stopRecording" throwing exception but still can't figure out what could be the solution. what do you mean by share the call stack ?