Xcode中的NSCameraUsageDescription键错误

问题描述 投票:0回答:1

我试图在Xcode中使用OpenCV访问一个项目的网络摄像头,但我一直得到这个错误。

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

我使用的命令行工具没有默认的Info.plist文件,所以我创建了一个Info.plist文件,并将其添加到我的项目目录中,添加了正确的键和描述,但它仍然显示出同样的错误。

我使用的键是 我使用的键是: 隐私-摄像头使用说明我使用的值是: 应用程序需要使用摄像头来进行边缘和线条检测。

xcode opencv info.plist xcode-command-line-tools
1个回答
0
投票

如果您将条目添加到正确的info.plist文件中,但仍然失败,这可能是因为Xcode有时无法注意到对资源文件(如info.plist、图像、音频、电影等)的更改。您可能需要执行一次清理或从Derived Data文件夹中删除应用程序构建产品,以迫使Xcode使用最新的版本

或者打开Info.plist作为源代码,添加这个。

<key>NSCameraUsageDescription</key>
<string>Camera usage description</string>
© www.soinside.com 2019 - 2024. All rights reserved.