Info.plist添加了但Xcode仍然崩溃。

3
我正在使用OpenCVXcode设置一个项目,想要使用VideoCapture打开网络摄像头。由于C++命令行项目没有Info.plist文件,我已经添加了自己的Info.plist文件,并将其添加到项目的目标/常规/身份下。从命令"plutil Info.plist"中,我的info.plist已通过验证。
我还将"Packaging"中的"Pre-Process Info.plist"更改为"yes"。然而,我仍然收到以下错误消息:

"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."

我尝试了很多StackOverFlow链接,全部失败,包括这个链接:Accessing webcam in Xcode with OpenCV (C++)
如果我不将Info.plist文件添加到finder(该链接底部的链接),我会收到同样的错误。
当我将它与可执行文件一起添加到Finder时,我会得到以下错误消息以及之前的错误:

"There was an error parsing the Info.plist for the bundle at URL"

请告诉我如何解决这个问题。非常感谢您的时间。

如果下面的答案解决了您的问题,请接受它。 - Anand
1个回答

0

在 Info.plist 文件中的键 "NSCameraUsageDescription" 下,你需要添加一些文本(使用说明)。否则,当应用程序访问相机时,应用程序将会崩溃。请参考下面的快照。

enter image description here

希望能对您有所帮助。如果还有其他问题,请告诉我们。

1
我的 Info.plist 文件中有 NSCameraUsageDescription 和麦克风的权限描述。 - Jonathan Ho
请检查XCode项目的构建设置以获取info.plist文件。在Build Settings中,应在打包下正确更新plist文件的位置。 - Anand

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接