React-native-permissions: Invalid RNPermission 'ios.permission.LOCATION_ALWAYS' should be one of

Created on 23 Jan 2020  路  3Comments  路  Source: zoontek/react-native-permissions

Question

In my code I have

import { request, PERMISSIONS } from 'react-native-permissions';
// ...
const backgroundLocationPermission = Platform.select({
  ios: PERMISSIONS.IOS.LOCATION_ALWAYS,
  android: PERMISSIONS.ANDROID.ACCESS_BACKGROUND_LOCATION,
});
// ...
request(backgroundLocationPermission)

it gives me

Simulator Screen Shot - iPhone 8 - 2 - 2020-01-23 at 11 11 20

Potentially related links (which didn't help to me):
https://github.com/react-native-community/react-native-permissions#%EF%B8%8F-if-you-encounter-the-error-invalid-rnpermission-x-should-be-one-of-
https://github.com/react-native-community/react-native-permissions/issues/326

Why? How to fix?

All 3 comments

@vvscode Please submit your Podfile.

@zoontek sure

Podfile.txt

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

As I though, you linked the wrong permission handler. If you ask for PERMISSIONS.IOS.LOCATION_ALWAYS, you need to link pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"

Then run pod install, clean your Xcode build, re-build: everything should be fine 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

viniciuszim picture viniciuszim  路  5Comments

Nazort picture Nazort  路  5Comments

TheEhsanSarshar picture TheEhsanSarshar  路  5Comments

vishalTechnoFreek picture vishalTechnoFreek  路  4Comments

altras picture altras  路  6Comments