React-native-permissions: iOS: Requesting Microphone permissions causes API misuse error "Invalid RNPermission Microphone should be one of: ("

Created on 12 Mar 2019  Â·  6Comments  Â·  Source: zoontek/react-native-permissions

Describe your environment
React-Native version: 0.55.4
Platform: iOS
Device: iPhone 7 Plus
OS version: 12.1.4
react-native-permissions version: 2.0.0-alpha.1
Devtools: Xcode 9.2

How to repeat issue and example

I'm calling
import { request, requestMultiple, IOS_PERMISSIONS } from "react-native-permissions";
request(IOS_PERMISSIONS.MICROPHONE).then(response => {
// Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
console.log(response)
})
and have error "Invalid RNPermission Microphone should be one of: ("
Please help me. Thanks you so much!

Most helpful comment

@eXist-FraGGer This is not an issue, you forgot to add custom handlers. See https://github.com/react-native-community/react-native-permissions#ios

If you want to check / request microphone permission, add

target 'YourAwesomeProject' do
  # …

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
end

This is now designed like this to avoid embedding unused code / permission usage descriptions and pass app store review 🙂

All 6 comments

This version is unstable ,generating too many errors. Please use the previous version of this package(1.1.1)

@NguyenPhong276 Please participate in the v2.0.0 PR until it's not at least in beta to avoid issues noise: https://github.com/yonahforst/react-native-permissions/pull/291 (please read the responses before submitting a problem which might be already solved)

The error is related to the package installation: you installed the Core package, but not the microphone permission handler (it's explained in the v2 README).
I flagged the v1.1.1 as latest so new install will not install the alpha version until it's ready.

Thank you for your support. <3

Still exists some problems.

Invalid RNPermission 'ios.permission.LOCATION_WHEN_IN_USE'. should be one of: (
)
reactConsoleErrorHandler @ ExceptionsManager.js:94
console.error @ YellowBox.js:63
logToConsole @ RCTLog.js:47
logIfNoNativeHook @ RCTLog.js:30
__callFunction @ MessageQueue.js:395
(anonymous) @ MessageQueue.js:106
__guard @ MessageQueue.js:343
callFunctionReturnFlushedQueue @ MessageQueue.js:105
(anonymous) @ RNDebuggerWorker.js:2

const permission = IS_IOS
            ? PERMISSIONS.IOS.LOCATION_WHEN_IN_USE
            : PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION;
        const currentStatus = await check(permission);

react-native-info

System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 753.69 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v10.15.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 16, 21, 22, 23, 24, 25, 26, 27, 28
      Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3, 29.0.2
      System Images: android-23 | Google APIs Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.0/11A420a - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1

@eXist-FraGGer This is not an issue, you forgot to add custom handlers. See https://github.com/react-native-community/react-native-permissions#ios

If you want to check / request microphone permission, add

target 'YourAwesomeProject' do
  # …

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
end

This is now designed like this to avoid embedding unused code / permission usage descriptions and pass app store review 🙂

We're facing the same issue even after adding PodSpec as shown above.

Was this page helpful?
0 / 5 - 0 ratings