expo-permissions returning Unrecognized Permissions for all persmissions

Viewed 783

I am currently working on an app. I was working with react-native and expo versions 34. I've recently faced a big error with sending images to the server, and I tried updating these libraries to version 36.0.0, but since then, expo-permissions only returns errors in every use on iOS, the same error, in fact, written as:

Possible Unhandled Promise Rejection

Error: Unrecognized Permissions: {
 notifications
}

I am using the following piece of code:

const { status: existingStatus } = await Permissions.getAsync(
  Permissions.NOTIFICATIONS
);

The same error is occurring with the permission for getting the camera roll

I have tried updating the components involved in it until I got these versions of the components:

"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"expo": "^36.0.0",
"expo-image-picker": "^8.0.1",
"expo-module-scripts": "^1.1.1",
"expo-permissions": "~8.0.0",
"react-native-unimodules": "^0.7.0",

This is my situation. I've tried using both Permissions.askAsync and Persmissions.getAsync, and cleaned the cache and re-installed all the components, as per acording this issue in this github issue: https://github.com/expo/expo/issues/6533

Does anyone has any idea about this?

3 Answers

So, I've figured out one thing which is how to get the CameraRoll permission, but I'm still looking into the Notifications permission.

Instead of using Permission.askAsync(Permissions.CAMERA_ROLL), using this expo-image-picker method will give you the permission:

ImagePicker.getCameraRollPermissionsAsync()

This will properly ask for the permission to access the camera roll in expo 36.

expo-permission is deprecated now. You can request permission from the library you are using. In your query, you are requesting notification permission, so for that, you can install expo-notifications and request from that.

const { status: existingStatus } = await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
  const { status } = await Notifications.requestPermissionsAsync();
  finalStatus = status;
}
if (finalStatus !== 'granted') {
  alert('Failed to get push token for push notification!');
  return;
}

I shared the process for requesting permission for the notification. If you have any query feel free to ask.

Related