React-native-permissions: Invalid RNPermission 'ios.permission.LOCATION_WHEN_IN_USE': Should be one of: ( ) on iOS after creating a new project

Created on 4 Dec 2019  Â·  7Comments  Â·  Source: zoontek/react-native-permissions

Bug

Unable to retrieve location permission in iOS. Getting the following error on a new react native project

Invalid RNPermission
‘ios.permission.LOCATION_WHEN_IN_USE’:
Should be one of: (
)

Environment info

System:
    OS: macOS 10.15
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 179.95 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.13.0 - /usr/local/bin/node
    Yarn: 1.19.0 - /usr/local/bin/yarn
    npm: 6.12.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3
      System Images: android-27 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5791312
    Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1

React Native Permissions library version - 2.0.5

Steps To Reproduce

Clone the following project https://github.com/DaniAkash/rn-permissions-ios-invalid-permission-issue

  1. Run yarn in the project directory and pod install inside the ios/ directory
  2. Run yarn ios to run the ios simulator

It should launch the app and request for iOS location permission but instead, it is throwing the above error.

Reproducible sample code

https://github.com/DaniAkash/rn-permissions-ios-invalid-permission-issue

This issue was previously mentioned in https://github.com/react-native-community/react-native-permissions/issues/346#issuecomment-542167950

All 7 comments

Just confirmed this is an issue with my system. Closing this issue for now

I am having the same issue, what solved it for you?

@marcovdijk Check https://github.com/react-native-community/react-native-permissions#%EF%B8%8F-if-you-encounter-the-error-invalid-rnpermission-x-should-be-one-of-

@marcovdijk do a npx react-native-clean-project if you face the issue even after adding the permission handlers

@DaniAkash It already is in it https://github.com/react-native-community/react-native-permissions/blob/master/README.md#%EF%B8%8F-if-you-encounter-the-error-invalid-rnpermission-x-should-be-one-of-

@zoontek Hi,brother, I am having the same issue, and I have run npx react-native-clean-project,but it not work for me,my podfile like this,what's wrong with me?

`# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
...
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
`

Was this page helpful?
0 / 5 - 0 ratings

Related issues

roaringUnicorn picture roaringUnicorn  Â·  17Comments

Daavidaviid picture Daavidaviid  Â·  18Comments

ozturkilgim picture ozturkilgim  Â·  31Comments

note89 picture note89  Â·  35Comments

jessiealbarian picture jessiealbarian  Â·  43Comments