一般在iOS开发下,咱们的app须要在Info.plist文件中配置所须要的各类限制;如摄像头权限;c++
本次咱们在mac下建立了一个command line 程序,而且设定是c++开发,并配置了opencv库的链接;app
以及调用opencv的摄像头相关代码;this
可是程序一运行就报了相似iOS上的摄像头权限错误;debug
his 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.code
解决办法:blog
因为command line 工程,没有默认建立Info.plist文件;ip
那么咱们手动新建文件,建立Info.plist文件;开发
而后在plist文件中添加摄像头限制;NSCameraUsageDescriptionstring
而后把Info.plist文件放到和执行程序同一目录;it
这样在Xcode编译运行程序,提示限制申请,点击 好,容许程序访问摄像头便可;
注意:若是 在Xcode上 clean了工程,那么debug目录会全新建立,Info.plist也要从新放置;