Xcode for MacOS Mojave中的C ++项目需要NSCameraUsageDescription

时间:2018-09-27 16:07:57

标签: c++ xcode macos-mojave

我试图在Xcode中运行OpenCV项目,似乎有新的需要为C ++应用程序NSCameraUsageDescription提供info.plist。

2018-09-28 00:03:15.181948+0800 k_nearest_detector_v2[23505:710470] [access] 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.
Program ended with exit code: 9

我该如何为C ++项目创建.plist文件,因为以前从未需要它。

2 个答案:

答案 0 :(得分:5)

找到了解决方案。将具有所需NSCameraUsageDescription,NSMicrophoneUsageDescription(或其他)的文件与来自XCode的组合文件放在一起(请参见下面的屏幕截图)。对于发行版和调试版。 Products-> Right Click-> Show in Finder "Info.plist"

答案 1 :(得分:2)

您甚至可以自动化@Valery Gromov描述的步骤。只需在构建阶段中复制文件即可。取消选中Copy only when installing复选框即可直接从Xcode运行它。 Copy Info.plist