7

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
lws803
  • 907
  • 2
  • 10
  • 21

2 Answers2

12

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"

Valery Gromov
  • 136
  • 2
  • 4
  • Hmmm anyway to generate an info.plist for the project tho. Or can we just use a generic one generated from other macOS swift projects? – lws803 Oct 01 '18 at 02:12
  • @lw803, you can create a new **"Property List"** from the "Resource" for MacOS or use a file from another project by deleting unnecessary fields. This is just a file with keys and values. – Valery Gromov Oct 01 '18 at 06:00
9

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

melbic
  • 11,988
  • 5
  • 33
  • 37