Info.plist 文件,用于使用 expo SDK 响应本机 ios 应用程序 [英] Info.plist file for react native ios app using expo SDK

查看:22
本文介绍了Info.plist 文件,用于使用 expo SDK 响应本机 ios 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm looking to properly format the Info.plist file in order to make in app purchase work with react-native-in-app-utils but I'm not sure how to format the data and what kind of data to insert.

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

This thread mentions the necessity to include the app bundle id inside the Info.plist file.

iOS 应用内购买 - 未收到任何产品

推荐答案

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

If you are using expo, it will not expose the entire info.plist to you.

您可以像这样在 app.json 中添加一个对象作为 ios 对象的子对象:

You can add an object as a child of ios object in the app.json like so:

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

这将写入本机级别,但这是有限的.这是您在使用 expo 时可以访问的所有密钥的列表

Which will write to the native level but this is limited. Here is a list of all the keys you can access with while using 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>

查看展会官方文档这里

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

If you need more low level access to your project, consider using react-native init MyProject instead of create-react-native-app MyProject.

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

This will provide you with full access to all ios and android bundles.

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

Or if you already built your app via create-react-native-app MyProject you can run react-native eject to get the build of react-native-init MyProject.

小心,这个命令执行后没有返回.

Be cautious, there is no returning once this command is ran.

这篇关于Info.plist 文件,用于使用 expo SDK 响应本机 ios 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆