我正在使用React Native Image Picker,但在响应“无法启动照片库”时收到此错误
React本机版本= 0.60.3
这是我的代码
handleProfilePicture = async () => {
const options = {};
try {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE ||
PermissionsAndroid.PERMISSIONS.CAMERA,
{
title: 'Wants to access your gallery',
buttonNeutral: 'Ask Me Later',
buttonNegative: 'Cancel',
buttonPositive: 'OK'
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
ImagePicker.showImagePicker(options, res => {
console.log('response', res);
});
} else {
console.log('Gallery permission denied');
}
} catch (err) {
console.warn(err);
}
};