Nsphotolibraryusagedescription Key Must Be Present in Info.Plist to Use Camera Roll

NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll

Thanks @rmaddy, I added this just after other key-string pairs in Info.plist and fixed the problem:

NSPhotoLibraryUsageDescription
Photo Library Access Warning

Edit:

I also ended up having similar problems on different components of my app. Ended up adding all these keys so far (after updating to Xcode8/iOS10):

NSPhotoLibraryUsageDescription
This app requires access to the photo library.
NSMicrophoneUsageDescription
This app does not require access to the microphone.
NSCameraUsageDescription
This app requires access to the camera.

Checkout this developer.apple.com link for full list of property list key references.

Full List:

Apple Music:

NSAppleMusicUsageDescription
My description about why I need this capability

Bluetooth:

NSBluetoothPeripheralUsageDescription  
My description about why I need this capability

Calendar:

NSCalendarsUsageDescription
My description about why I need this capability

Camera:

NSCameraUsageDescription
My description about why I need this capability

Contacts:

NSContactsUsageDescription
My description about why I need this capability

FaceID:

NSFaceIDUsageDescription
My description about why I need this capability

Health Share:

NSHealthShareUsageDescription
My description about why I need this capability

Health Update:

NSHealthUpdateUsageDescription
My description about why I need this capability

Home Kit:

NSHomeKitUsageDescription
My description about why I need this capability

Location:

NSLocationUsageDescription
My description about why I need this capability

Location (Always):

NSLocationAlwaysUsageDescription
My description about why I need this capability

Location (When in use):

NSLocationWhenInUseUsageDescription
My description about why I need this capability

Microphone:

NSMicrophoneUsageDescription
My description about why I need this capability

Motion (Accelerometer):

NSMotionUsageDescription
My description about why I need this capability

NFC (Near-field communication):

NFCReaderUsageDescription
My description about why I need this capability

Photo Library:

NSPhotoLibraryUsageDescription
My description about why I need this capability

Photo Library (Write-only access):

NSPhotoLibraryAddUsageDescription
My description about why I need this capability

Reminders:

NSRemindersUsageDescription
My description about why I need this capability

Siri:

NSSiriUsageDescription
My description about why I need this capability

Speech Recognition:

NSSpeechRecognitionUsageDescription
My description about why I need this capability

NSPhotoLibraryUsageDescription in Xcode8

Localizing of info.plist file may be very unuseful, especially if you use many languages in your apps.
The simplest way for localizing NSPhotoLibraryUsageDescription, NSLocationWhenInUseUsageDescriptionor NSCameraUsageDescription keys is to describe it in InfoPlist.strings file.

  • Create new *.strings file with name InfoPlist;
  • Press Localize... button in file inspector and choose the default language;
  • Add new records in your new InfoPlist.strings file. For example
    in English:

NSLocationWhenInUseUsageDescription = "Location usage description";

NSPhotoLibraryUsageDescription = "Photos usage description";

NSCameraUsageDescription = "Camera usage description";

For more information Apple docs

Missing Purpose String in Info.plist for Photo access

You added NSPhotoLibraryAddUsageDescription key to your plist file. At least that's what your screen shot says. NSPhotoLibraryAddUsageDescription is the write-only access to the Photos app. On the other hand, if you would like to request the read or write access to the Photos app, use this key: NSPhotoLibraryUsageDescription

Here's a screenshot of both keys in Info.plist when viewed as a property list file on Xcode:

Sample Image
The first one is the NSPhotoLibraryAddUsageDescription and the second one is the NSPhotoLibraryUsageDescription key.

So, if you have any code (or a library) that is trying to read from the photo library, then you are required to add the NSPhotoLibraryUsageDescription key.

iOS app (MobileFirst) is rejected by Apple (NSPhotoLibraryUsageDescription)

So, it is the answer: embedded Cordova plugins that comes with MobileFirst caused problems. Submission to TestFlight without barcodescanner but with these plugins failed with the same issue. Removing embedded plugins solved the problem and submission was accepted.

https://mobilefirstplatform.ibmcloud.com/blog/2016/10/25/supporting-privacy-changes-in-ios-10/

P.S. It is not clear why there were only problems with Photo Library and not with Contacts, for example, but anyway it worked.

Can we keep description empty in info.plist for key NSPhotoLibraryAddUsageDescription?

From the documentation (emphasis mine):

Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and that accesses the user’s photo library, must statically declare the intent to do so. Include the NSPhotoLibraryAddUsageDescription key (in apps that link on or after iOS 11) or NSPhotoLibraryUsageDescription key in your app’s Info.plist file and provide a purpose string for the key. If your app attempts to access the user’s photo library without a corresponding purpose string, your app exits.

In other words, no, you must provide a reason about why you require access to the photo library. Otherwise, iOS will kill your app

How to Localize NSPhotoLibraryUsageDescription key (ALAssets)

There is a file you can create (which may be created for you when you create a project) called InfoPlist.strings. This file is used and localized much like the file Localizable.strings.

In it you would have and entry something like:

NSPhotoLibraryUsageDescription = "Test of new Photos warnings";

Note that there are no quotation marks around the key

I think as long as the key is included in info.plist, it will localized using the value in InfoPlist.string if it is available for the language. Otherwise it will use whatever is defined in info.plist.



Related Topics



Leave a reply



Submit