ios - 用于使用 expo SDK react native ios 应用程序的 Info.plist 文件

标签 ios reactjs react-native in-app-purchase

我希望正确格式化 Info.plist 文件,以便使用 react-native-in-app-utils 进行应用内购买,但我不确定如何格式化数据以及要使用哪种数据插入。

该线程提到了在 Info.plist 文件中包含应用程序包 ID 的必要性。

iOS in app purchase - no products received

最佳答案

如果您使用的是 expo,它不会向您公开整个 info.plist

世博会解决方法

您可以在 app.json 中添加一个对象作为 ios 对象的子对象,如下所示:

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

这将写入 native 级别,但这是有限的。这是您在使用 expo 时可以访问的所有 key 的列表

<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官方文档here

React-native 初始化

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

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

React-native 弹出

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

请注意,此命令执行后不会返回。

关于ios - 用于使用 expo SDK react native ios 应用程序的 Info.plist 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48157185/

相关文章:

ios - 分析图像并在 iOS 中查找点

javascript - YouTube API 无法在 iOS (iPhone/iPad) 中运行,但在桌面浏览器中运行良好?

javascript - 数字的 Formik 输入值即使在作为数字通过 Formik 验证后也变为字符串

javascript - 管理 React 中同级组件之间的许多输入 - 最佳方法?

javascript - Redux 状态更新不会传递到我的组件无状态函数中的方法

ios - 如何根据时间字段(自 1970 年午夜以来的秒数)获取日期?

ios - GCM iOS Production 未收到通知

meteor + react : Server side routes?

reactjs - 可扩展的 TextInput 到 react-native 中的最大行数

javascript - 错误: package android. support.annotation不存在