【问题标题】:Expo Permissions returns status of 'undetermined'Expo Permissions 返回“未确定”状态
【发布时间】:2020-05-31 13:48:32
【问题描述】:

在我的 react native 应用程序中,我请求访问相机胶卷的权限,如下所示:

  getPermissionAsync = async () => {
    const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
    if (status !== "granted") {
      alert("Sorry, we need camera roll permissions to make this work!");
    }
    await this.setState({ permission: status === "granted" });
  };

  _pickMedia = async (index, type) => {
    if (this.state.permission != true) {
      await this.getPermissionAsync();
    }
    if (this.state.permission == true) {
        // get image
      } catch (E) {
        console.log(E);
      }
    }
  };

这在测试期间按预期工作,但对于我在 Google Play 上发布的版本,无论用户是否授予权限,状态都会返回为 undetermined。这是什么意思?

【问题讨论】:

    标签: android react-native permissions expo


    【解决方案1】:

    将 react-native-community@react-native-permissions 升级到 2.0.0 解决了这个问题。 参考:https://github.com/react-native-community/react-native-permissions/issues/295

    【讨论】:

    • 对不起,这不起作用 - 我正在使用 expo 权限
    猜你喜欢
    • 2020-09-17
    • 2020-07-13
    • 2020-04-05
    • 1970-01-01
    • 2021-03-20
    • 2020-08-20
    • 1970-01-01
    • 2018-12-25
    • 1970-01-01
    相关资源
    最近更新 更多