Xcode Doesn't Allow Us to Use Webcam without asking

0xkoji - Jun 15 '19 - - Dev Community

Today I wrote a simple script which is using the webcam with openFrameworks. It's been a while since I wrote oF script for the webcam.

Then, I got the following 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.
Enter fullscreen mode Exit fullscreen mode

Obviously, Xcode told me that I don't allow you to use the webcam without telling the reason. This is the same as Swift/Objective-C when need to use a phone camera.

But, a little bit surprising to me lol.

The solution is to add the following to openFrameworks-Info.plist

<key>NSCameraUsageDescription</key>
    <string>Need to access your camera to capture a picture and record a video.</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>Need to access your microphone to record a video.</string>
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .