Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSCameraUsageDescription needed for C++ projects in Xcode for MacOS Mojave

I am trying to run OpenCV projects in Xcode and it seems like there's a new need to provide an info.plist for C++ applications NSCameraUsageDescription.

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

How do I go about creating a .plist file for a C++ project as it has never been needed before.

like image 681
lws803 Avatar asked Sep 27 '18 16:09

lws803


2 Answers

Found a solution. Put the file with the desired NSCameraUsageDescription, NSMicrophoneUsageDescription (or others) with the assembled file from XCode (See screen shots below). For the Release and Debug versions. Products-> Right Click-> Show in Finder"Info.plist"

like image 136
Valery Gromov Avatar answered Nov 17 '22 11:11

Valery Gromov


You can even automate the steps described by @Valery Gromov. Just copy the file in the Build Phases. Uncheck the Copy only when installing checkbox to be able to run it directly from Xcode. Copy Info.plist

like image 9
melbic Avatar answered Nov 17 '22 12:11

melbic