Error Permission to use CAMERA and CAMERA_ROLL

Hello everybody,

when i use this code, status come “granted” but i cannot open the camera

const permissions = Permissions.CAMERA;
const { status } = await Permissions.askAsync(permissions);

if (status === "granted") {
  let image = await ImagePicker.launchCameraAsync({
    mediaTypes: "Images",
    allowsEditing: true,
    aspect: [4, 3],
    base64: true
  }).catch(error => console.log(permissions, { error }));

  this.setState({ editPhoto: image.uri });

  ImageManipulator.manipulate(image.uri, [], {
    base64: true,
    compress: 0
  }).then(img => {
    ProfileStore.setBaseImage(img.base64);
  });
}

what’s wrong ?

i’m using expo sdk 30.0.0

Hey @virtusdev,

launchCameraAsync requires both CAMERA and CAMERA_ROLL permissions. Have you prompted and granted both? https://docs.expo.io/versions/v30.0.0/sdk/imagepicker#expoimagepickerlaunchcameraasyncoptions

Cheers,

Adam

Good morning, Adam

Thanks for your answer, it was very helpful. I got it!!

1 Like

Good morning, Virtus. Glad I could lend a hand!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.