【发布时间】:2020-06-28 23:20:39
【问题描述】:
SDK 版本:35
平台(Android/iOS/web/all):Android
我的应用正在尝试从用户的相机中获取照片。在调用 ImagePicker.launchCameraAsync 之前,我只需在我的 expo 应用程序中使用此代码
const { status } = await Permissions.askAsync(Permissions.CAMERA, Permissions.CAMERA_ROLL);.
if(status !== ‘granted’) {
dispatchMsg(‘error’, ‘We need your permission to get photo’);
return;
}
从用户的角度来看,他们会看到系统两次请求权限
问题是......即使用户已经授予了两者的权限,状态仍然是“拒绝”!有趣的是,这只发生在独立的生产应用程序中。如果我没记错的话……这个问题最近才发生。我的应用在 Playstore 中已经存在 6 个多月了,最初直到最近才出现问题。
我尝试在生产环境中打印调试消息,结果如下:
-
Permissions.getAsync(Permissions.CAMERA):
{“status”:“granted”,“expires”:“never”,“permissions”:{“camera”:{“status”:“granted”,“expires”:“never”}}} -
Permissions.getAsync(Permissions.CAMERA_ROLL):
{“状态”:“拒绝”,“过期”:“从不”,“权限”:{“cameraRoll”:{“状态”:“拒绝”,“过期”:“从不”}}}
我非常确定我选择授予权限……向我报告错误的用户也是如此。就像我在这个问题似乎最近才发生之前告诉你的那样。由于此问题仅发生在我的生产应用程序中,因此有任何解决方法的想法。
编辑:这是我在 Android 设置中的应用权限列表的屏幕截图。似乎没有任何问题
【问题讨论】:
-
android 有什么规格的设备?
标签: android expo expo-permissions