代码之家  ›  专栏  ›  技术社区  ›  Hugo

信息。使用expo SDK的react native ios应用程序的plist文件

  •  19
  • Hugo  · 技术社区  · 7 年前

    我正在寻找正确的格式信息。plist文件,以使应用内购买与react native应用内UTIL一起工作,但我不确定如何格式化数据以及要插入的数据类型。

    此线程提到了在信息中包含应用程序包id的必要性。plist文件。

    iOS in app purchase - no products received

    1 回复  |  直到 7 年前
        1
  •  61
  •   Philipp Otto    6 年前

    如果您使用的是expo,则不会暴露整个 info.plist 给你。

    世博会解决方案

    可以将对象添加为的子对象 ios 中的对象 app.json 像这样:

    "infoPlist": {
      "NSCameraUsageDescription": "This app uses the camera to scan barcodes on event tickets."
    },
    

    将写入本机级别,但这是有限的。以下是使用expo时可以使用的所有钥匙列表

    <key>NSCameraUsageDescription</key>
    <string>Allow Expo experiences to use your camera</string>
    <key>NSContactsUsageDescription</key>
    <string>Allow Expo experiences to access your contacts</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Allow Expo experiences to use your location</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Allow Expo experiences to access your microphone</string>
    <key>NSMotionUsageDescription</key>
    <string>Allow Expo experiences to access your device's accelerometer</string>
    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>Give Expo experiences permission to save photos</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Give Expo experiences permission to access your photos</string>
    

    查看世博会官方文档 here

    反应本机初始化

    如果需要对项目进行更多的低级访问,请考虑使用 react-native init MyProject 而不是 create-react-native-app MyProject .

    这将为您提供对所有ios和android捆绑包的完全访问权限。

    反应本机弹出

    或者如果您已经通过 创建react native app MyProject 你可以跑步 react-native eject 要获得 react-native-init MyProject .

    小心,一旦运行此命令,就不会返回。