小编典典

使用EXPO SDK响应本机ios应用的Info.plist文件

reactjs

我正在寻找正确格式化Info.plist文件的功能,以使应用程序内购买可以与react-native-in-app-
utils一起使用,但是我不确定如何格式化数据以及插入哪种数据。

该线程提到有必要在Info.plist文件中包含应用程序捆绑包ID。


阅读 350

收藏
2020-07-22

共1个答案

小编典典

如果您使用的是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>

在此处查看expos官方文档

反应本征

如果您需要对项目的更多低级访问权限,请考虑使用react-native init MyProject代替create-react-native-app MyProject

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

反应性喷射

或者,如果您已经通过构建了应用程序,则create-react-native-app MyProject可以运行react-native eject来构建react-native-init MyProject

注意,运行该命令后将不会返回任何内容。

2020-07-22