如何在 Expo React Native 应用程序的请求位置权限模式中添加消息?

问题描述 投票:0回答:2

我有一个 Expo React Native 应用程序,需要在请求使用用户位置的权限时向应用程序中显示的模式警报添加一条消息。

苹果表示,它必须具有足够的描述性,以便用户了解位置泄露的目的是什么:

“请将应用程序请求用户位置的原因放入权限模式警报中,以便用户知道为什么要求他们使用其位置。”

在 app.json 文件中,我添加了以下内容,但它没有显示在弹出窗口中:

"ios": {
      "supportsTablet": true,
      "bundleIdentifier": "**********",
      "infoPlist": {
        "NSLocationAlwaysUsageDescription": "This app uses your location to determine the current weather conditions in your local area."
      }
    },

enter image description here

感谢您的帮助

react-native expo
2个回答
0
投票

以下内容在 app.json 文件中起作用。就我而言,我认为 NSLocationWhenInUseUsageDescription 键值对起到了作用。

"ios": {
      "bundleIdentifier": "**********",
      "supportsTablet": true,
      "infoPlist": {
        "NSLocationWhenInUseUsageDescription": "This app uses your location to determine the current weather conditions in your local area.",
        "NSLocationAlwaysUsageDescription": "This app uses your location to determine the current weather conditions in your local area.",
        "NSLocationAlwaysAndWhenInUseUsageDescription": "This app uses your location to determine the current weather conditions in your local area."
      }

0
投票

显然你应该使用插件配置

    {
  "expo": {
    "plugins": [
      [
        "expo-location",
        {
          "locationAlwaysAndWhenInUsePermission": "Allow $(PRODUCT_NAME) to use your location."
        }
      ]
    ]
  }
}
© www.soinside.com 2019 - 2024. All rights reserved.