3

I'm setting up a project utilizing OpenCV and Xcode and I want to open up the webcam using VideoCapture. I have added my own Info.plist file (as a command-line project in C++ doesn't have an Info.plist) and I have added it to the project under targets/general/identity. My info.plist is verified as OK from the command "plutil Info.plist".

I also have the "Pre-Process Info.plist" tag under "Packaging" changed to "yes". However, I still get this error:

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

I have tried many StackOverFlow links and they have all failed, including this one: Accessing webcam in Xcode with OpenCV (C++)

If I don't add the Info.plist file to finder (the link at the bottom of the link), I get the same error.

When I add it to finder along with the executable, I get this error along with the previous error:

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

Please let me know how I can fix this. Thank you so much for your time.

Anand
  • 1,820
  • 2
  • 18
  • 25
Jonathan Ho
  • 41
  • 1
  • 6

1 Answers1

0

You need to have some text (Usage Description) in Info.plist for key "NSCameraUsageDescription". Otherwise, the app will crash when app access Camera. Please see the snapshot below.

enter image description here

Hope it helps. Otherwise, please let us know.

Anand
  • 1,820
  • 2
  • 18
  • 25
  • 1
    My Info.plist has NSCameraUsageDescription and the one for microphone as well. (Written exactly has you have it) – Jonathan Ho Apr 16 '19 at 15:28
  • Please check XCode project Build settings for info.plist file. The location of plist file should be correctly updated under Packaging in Build Settings. – Anand Apr 16 '19 at 15:40