0

I'm trying to access a webcam for a project using OpenCV in Xcode, but I keep getting 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'm using a command line tool which doesn't come with a default Info.plist file, so I created an Info.plist file and added it to my project directory and added the correct key and description, but it's still showing me the same error.

The key I'm using is: Privacy - Camera Usage Description The value I'm using is: App requires camera use to do edge and line detection.

parsha
  • 1
  • 1
  • Make sure you do it for all the targets who access Camera. I forgot to add NSCameraUsageDescription for my App Clip target. – sabiland Oct 27 '20 at 08:14

1 Answers1

1

If you added the entry to the correct info.plist file, but it still failed, it may be because Xcode sometimes fails to notice changes to resource files like info.plist, images, audio, movies, etc. You may need to perform a clean or delete the app build product from the Derived Data folder to force Xcode to use the latest version

Alternatively open Info.plist as source code and add this:

<key>NSCameraUsageDescription</key>
<string>Camera usage description</string>
Debashish Das
  • 859
  • 4
  • 14