最近我开始出现这样的错误:

NSPhotoLibraryUsageDescription密钥必须存在于Info中.Flutter 向

我正在使用React Native构建我的应用程序(我不熟悉ios Native开发),我不知道如何将此密钥添加到信息中.普利斯特

你能举个例子吗?谢谢

我使用的是npm软件包"react-native-camera-roll-picker": "^1.1.7"

enter image description here

推荐答案

谢谢@rmaddy,我在Info.plist中的其他键-字符串对之后添加了这个,并解决了这个问题:

<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library Access Warning</string>

Edit:

我的应用程序的不同组件也出现了类似的问题.到目前为止(在更新到Xcode8/iOS10之后)添加了所有这些密钥:

<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>

请查看这developer.apple.com个链接,了解full list个属性列表关键字引用.

Full List:

Apple Music:

<key>NSAppleMusicUsageDescription</key>
<string>My description about why I need this capability</string>

蓝牙:

<key>NSBluetoothPeripheralUsageDescription</key>  
<string>My description about why I need this capability</string>

日历:

<key>NSCalendarsUsageDescription</key>
<string>My description about why I need this capability</string>

摄像机:

<key>NSCameraUsageDescription</key>
<string>My description about why I need this capability</string>

联络:

<key>NSContactsUsageDescription</key>
<string>My description about why I need this capability</string>

FaceID:

<key>NSFaceIDUsageDescription</key>
<string>My description about why I need this capability</string>

健康共享:

<key>NSHealthShareUsageDescription</key>
<string>My description about why I need this capability</string>

健康更新:

<key>NSHealthUpdateUsageDescription</key>
<string>My description about why I need this capability</string>

家庭套件:

<key>NSHomeKitUsageDescription</key>
<string>My description about why I need this capability</string>

位置:

<key>NSLocationUsageDescription</key>
<string>My description about why I need this capability</string>

地点(始终):

<key>NSLocationAlwaysUsageDescription</key>
<string>My description about why I need this capability</string>

位置(使用时):

<key>NSLocationWhenInUseUsageDescription</key>
<string>My description about why I need this capability</string>

麦克风:

<key>NSMicrophoneUsageDescription</key>
<string>My description about why I need this capability</string>

运动(加速度计):

<key>NSMotionUsageDescription</key>
<string>My description about why I need this capability</string>

NFC(近场通信):

<key>NFCReaderUsageDescription</key>
<string>My description about why I need this capability</string>

图片库:

<key>NSPhotoLibraryUsageDescription</key>
<string>My description about why I need this capability</string>

图片库(只写访问):

<key>NSPhotoLibraryAddUsageDescription</key>
<string>My description about why I need this capability</string>

提醒:

<key>NSRemindersUsageDescription</key>
<string>My description about why I need this capability</string>

Siri:

<key>NSSiriUsageDescription</key>
<string>My description about why I need this capability</string>

语音识别:

<key>NSSpeechRecognitionUsageDescription</key>
<string>My description about why I need this capability</string>

Ios相关问答推荐

OSLog(Logger)通过简单的字符串插值给出错误

如何在wiftUI中管理导航栈?

如何使用 Rxswift 处理程序最喜欢的按钮

SwiftUI 每秒从 Timer 更新单个 @State 属性,每秒也重绘整个视图

拔下设备后,DriverKit USB 驱动程序 (dext) 进程不会终止

将角半径仅应用于 Swiftui 中按钮的两个角

渲染的海边重定向在物理 iOS 设备上不起作用

Xcode 13.4.1 (13F100)Command CodeSign 失败,退出代码非零我应该删除哪个证书?

UIViewRepresentable - MKMapView 没有得到更新

AVPlayer 退出全屏

如何在 SwiftUI 的列表中使用带有 swipeActions 的 NavigationLink

我可以使用同一个 Firebase 应用将多个 Flutter 应用添加到一个 Firebase 数据库吗?

UILabel - 字符串作为文本和链接

如何从一个特定的视图控制器中隐藏导航栏

如何在react 导航中获取当前路由名称?

以编程方式创建按钮并设置背景图像

判断密钥是否存在于 NSDictionary 中

如何在 UILabel 中找到文本子字符串的 CGRect?

Objective-C 将 NSDate 设置为当前 UTC

如何为 NSDate 添加一个月?