zoontek / react-native-permissions

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

Permissions microphone does not pop up and always return unavailable #789

Closed rodrigodiasf1984 closed 1 year ago

rodrigodiasf1984 commented 1 year ago

Bug summary

  1. infoPlist image

  2. PodFile image

  3. my code to request permissions image

  4. app running on my iPhone plugged on xcode image

Library version

"react-native-permissions": "^3.6.1"

Environment info

➜ yarn react-native info
yarn run v1.22.19
warning ../../../package.json: No license field
$ /Users/rodrigodiasdefigueiredo/Desktop/TheBasement/zerel-parksharing-mobile/node_modules/.bin/react-native info
info Fetching system and libraries information...
System:
    OS: macOS 13.4
    CPU: (8) arm64 Apple M1
    Memory: 66.63 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.1 - /var/folders/wd/x3r0yp1n391c_pvsh8vqwwf80000gn/T/yarn--1689856113181-0.17340064864994176/node
    Yarn: 1.22.19 - /var/folders/wd/x3r0yp1n391c_pvsh8vqwwf80000gn/T/yarn--1689856113181-0.17340064864994176/yarn
    npm: 9.7.2 - ~/.npm-global/bin/npm
    Watchman: 2023.06.12.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/rodrigodiasdefigueiredo/.rvm/gems/ruby-2.7.5/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.10121639
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.7 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.6 => 0.70.6 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
✨  Done in 2.54s.

Steps to reproduce

Reproducible sample code

let permissionStatusCamera = '';
    let permissionStatusMicrophone = '';

    if (Platform.OS === 'ios') {
      permissionStatusCamera = await request(PERMISSIONS.IOS.CAMERA);
      permissionStatusMicrophone = await request(PERMISSIONS.IOS.MICROPHONE);
    } else {
      permissionStatusCamera = await request(PERMISSIONS.ANDROID.CAMERA);
      permissionStatusMicrophone = await request(
        PERMISSIONS.ANDROID.RECORD_AUDIO,
      );
    }

    console.log(
      '✅ ~  permissionStatusMicrophone:',
      permissionStatusMicrophone,
    );
    console.log('✅ ~  permissionStatusCamera:', permissionStatusCamera);
zoontek commented 1 year ago

Can you provide a screenshots from the Settings > Your app to confirm that it's not enabled?

IMG_9652

Because if it is, it's normal 😅

rodrigodiasf1984 commented 1 year ago

Hi , thanks for your help! Please take a look at the screenshot Image_20230720_144819

rodrigodiasf1984 commented 1 year ago

My ios version: 16.2

rodrigodiasf1984 commented 1 year ago

on the simulador it´s showing the pop up image image

but isn´t on a real device iPhone x image

zoontek commented 1 year ago

Uninstall the app on your device, clean your project and retry: https://www.npmjs.com/package/react-native-clean-project (especially Xcode DerivedData)

EDIT: I highly recommend updating to the latest version and reactNativePermissionsIOS in your package.json, which results in a lot less caching issues: https://github.com/zoontek/react-native-permissions#ios