SwiftUI Application crashes even though I added NSCameraUsageDescription in info.plist

1.1k Views Asked by At

I’m using Xcode 11.3.1 (11C504) and iOS 13

I am using camera to upload photos on my app, app crashes with following very known message:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.

Added the NSCameraUsageDescription in my info.plist, but I still get the crash no matter what. Cleaned the app, deleted the app, even restarted Xcode, still crashed with same message every time.

Did this happen to anyone? Did anyone made it work? Am I missing anything?

<key>NSPhotoLibraryUsageDescription</key>
<string>This application saves Photos and videos to your library.</string>
1

There are 1 best solutions below

4
On

If you want to write, save photos into your photos library then you have to add below key in info.plist

Obviously, to solve this crash you have to add the

NSPhotoLibraryAddUsageDescription into the application's plist file:

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Our application needs permission to write photos...</string>

Below are the things you can try.

1- Can you check whether your info.plist is correctly attached with target

2- Secondly are you sure, mistakenly you are not adding on Test target info.plist.

3- Last option would be to build clean your project, delete drive data and restart Xcode.

Hope it will help.