Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ SDK 36 ] Permissions.askAsync(Permissions.LOCATION) -> Unrecognized permission #6533

Closed
GuillaumeSarfati opened this issue Dec 16, 2019 · 14 comments
Assignees
Labels

Comments

@GuillaumeSarfati
Copy link

GuillaumeSarfati commented Dec 16, 2019

Hello, I make the migration from SDK 35 to the SDK 36, I don't know why but when I ask for location I have this error :

[Error: Unrecognized permission: (
    location
)]

Is this possible that the permission location was rename to split the behavior always/whenInUse ?

Edit : Its working now with Location.requestPermissionsAsync() but I thought the old permission API was always available no ? The example in the doc need to be update maybe

Environment

Expo CLI 3.11.1 environment info:
System:
OS: macOS 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
Yarn: 1.12.1 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.3/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
expo: ^36.0.0 => 36.0.0
react: 16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4
react-navigation: ^4.0.6 => 4.0.10
npmGlobalPackages:
expo-cli: 3.11.1

  • ExpoKit
@lukmccall
Copy link
Contributor

Hi @GuillaumeSarfati, could you provide your package.json(I only need your expo related dependencies)?
I guess it happens on iOS. Could you confirm that?
Last but not least, the old API still should work normally.

@GuillaumeSarfati
Copy link
Author

GuillaumeSarfati commented Dec 16, 2019

Hello @lukmccall,

I have the exact same issue on Camera, Camera Roll , it's working fine if I migrate to the new API.
Same issue with Notifications but I don't find the new API ?

  • Yes i am on iOS

  • My expo dependencies

{
    "expo": "^36.0.0",
    "expo-apple-authentication": "^2.0.0",
    "expo-asset": "~8.0.0",
    "expo-av": "~8.0.0",
    "expo-blur": "~8.0.0",
    "expo-camera": "~8.0.0",
    "expo-constants": "~8.0.0",
    "expo-contacts": "~8.0.0",
    "expo-facebook": "~8.0.0",
    "expo-file-system": "^8.0.0",
    "expo-font": "~8.0.0",
    "expo-image-picker": "~8.0.0",
    "expo-linear-gradient": "~8.0.0",
    "expo-local-authentication": "~8.0.0",
    "expo-location": "~8.0.0",
    "expo-sms": "~8.0.0",
    "expokit": "36.0.0"
}

@lukmccall
Copy link
Contributor

Thank you for more information. Could you also provide me with your Permissions.askAsync call?

@lukmccall
Copy link
Contributor

And is that exactly the error message you get?

[Error: Unrecognized permission: (
    location
)]

@GuillaumeSarfati
Copy link
Author

GuillaumeSarfati commented Dec 16, 2019

Yes exactly, I edit my message above, the bigger problem for me now is that I have the same issue with the Notifications and I don't see the new API in the doc

 
import * as Permissions from 'expo-permissions';

// ....

async componentDidMount() {

 try {
   const permission = await Permissions.askAsync(Permissions.NOTIFICATIONS);
   // ...
 } catch (e) {
   console.log(e);
 }

}

// ...

Result :

[Error: Unrecognized permission: (
    notifications
)]

@lukmccall
Copy link
Contributor

lukmccall commented Dec 16, 2019

It's pretty weird because your result looks like Permissions.askAsync was called with an array.
You should receive a message like this:

[Error: Unrecognized permission: notifications]

You can try clean node modules and cache:

  • npm - rm -rf node_modules/ & npm cache clean --force & npm install
  • yarn - rm -rf node_modules/ & npm cache clean --force & yarn install

Notifications, for now, don't have a new API.

@GuillaumeSarfati
Copy link
Author

@lukmccall Same result, I make a fresh app and I eject it, lets keep in touch

@GuillaumeSarfati
Copy link
Author

@lukmccall working like a charm from a fresh app...... I miss something... Do you have some advises ?

@lukmccall
Copy link
Contributor

lukmccall commented Dec 16, 2019

Please, try running your project with expo start -c and provide the output of npm list expo-permissions.

@lukmccall lukmccall self-assigned this Dec 16, 2019
@GuillaumeSarfati
Copy link
Author

Ok Thank you so much @lukmccall, react-native-unimodules wasn't 0.7.0 !

@vvscode
Copy link

vvscode commented Dec 31, 2019

I have "react-native-unimodules": "^0.7.0", but still same issue.

What else can be done?

expo-permissions@~8.0.0:
  version "8.0.0"

@vvscode
Copy link

vvscode commented Dec 31, 2019

I even checked sources and don't see if it supports other permissions except Notification https://stackoverflow.com/questions/59541610/expo-permissions-error-unrecognized-persmission-location

@lukmccall
Copy link
Contributor

Hi @vvscode, please check #6682 (comment)

@vvscode
Copy link

vvscode commented Jan 7, 2020

@lukmccall thanks, already discovered the same. It worth to add this point to the doc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants