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: (
)
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
Clone the following project https://github.com/DaniAkash/rn-permissions-ios-invalid-permission-issue
yarn in the project directory and pod install inside the ios/ directoryyarn ios to run the ios simulatorIt should launch the app and request for iOS location permission but instead, it is throwing the above error.
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
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-
@marcovdijk @DaniAkash check https://github.com/react-native-community/react-native-permissions/pull/384
@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
`