zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.08k stars 831 forks source link

IOS - Error when start record audio. #672

Closed jcvidela closed 2 years ago

jcvidela commented 2 years ago

Bug summary

when I do a SoundRecorder.start(params here...), it gives me the following error,

rror: { } {"code":"init_recorder_error","message":"{\n}","domain":"NSOSStatusErrorDomain","userInfo":{},"nativeStackIOS":

My code: const options: SoundRecorderOptions = { format: Platform.OS === 'android' ? SoundRecorder.FORMAT_AMR_NB : SoundRecorder.FORMAT_AMR, }; try { await SoundRecorder.start(SoundRecorder.PATH_CACHE + audioFileName, options); } catch (e) { // handle error here. }

Library version

^1.5.0

Environment info

System:
    OS: macOS 11.5.2
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 409.91 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v15.14.0/bin/yarn
    npm: 7.7.6 - ~/.nvm/versions/node/v15.14.0/bin/npm
    Watchman: 2021.12.06.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 26, 27, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 13.0/13A5154h - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.64.1 => 0.64.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. …Install the library, step by step
  2. … SoundRecorder.start()

Reproducible sample code

async function startSoundRecorder() {
    const audioTime = moment().utc().format('YYYYMMDDHHMISS');
    const audioFileName = `/audio_${audioTime}.amr`;
    setCurrentAudioName(audioFileName);
    const options: SoundRecorderOptions = {
      format: Platform.OS === 'android' ? SoundRecorder.FORMAT_AMR_NB : SoundRecorder.FORMAT_AMR,
    };
    try {
      await SoundRecorder.start(SoundRecorder.PATH_CACHE + audioFileName, options);
    } catch (e) {
      HandleUIError(e);
    }
  }
zoontek commented 2 years ago

Wrong library.