一直在请求CAMERA_ROLL的许可.获取错误:undefined不是对象(正在评估'_expo.Permis



在请求react native中的权限时收到此警告(几乎是一个错误,因为应用程序此时显示黄色警告(。下面是我的代码

//MY IMPORTS
import * as ImagePicker from 'expo-image-picker';
import * as Permissions from 'expo-permissions';

//My CODE
onImageUpload = async () => {
const {status, permissions} = await Permissions.askAsync(Permissions.CAMERA_ROLL);
try {
if (status === 'granted') {
console.log("granted!!")
}
} catch (err) {
console.log('onImageUpload error:' + err.message);
}
}

您似乎没有正确安装模块。从命令中执行安装命令。

您需要运行expo install expo-permissions

相关内容

最新更新