By Murat Ozgul


2016-09-15 20:25:55 8 Comments

Recently I started to get this error:

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

I am using React Native to build my app (I am not familiar with ios native development) and I don't know how to add this key to Info.plist

Can you post an example? Thanks

I am using npm package "react-native-camera-roll-picker": "^1.1.7"

enter image description here

7 comments

@Shanu Singh 2019-05-18 07:16:26

In order to save or retrieve an image from the camera roll. Additionally, you need to ask the user for the permission otherwise you'll get this error or your app may get crashed. To save yourself from this add this into your info.plist

<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires read and write permission from the user.</string>

In the case of Xamarin.iOS

 if you're adding it from the generic editor then "Privacy - Photo Library Additions Usage Description" will be the given option you will find out instead of "NSPhotoLibraryAddUsageDescription".

@Reza.Ab 2018-01-05 23:02:15

You need to paste these two in your info.plist, The only way that worked in iOS 11 for me.

    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires access to the photo library.</string>

    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>This app requires access to the photo library.</string>

@Aneh Thakur 2018-01-25 09:29:24

Thanks this code really help me :)

@Reza.Ab 2018-01-25 09:33:19

You are welcome. @thakur

@Murat Ozgul 2016-09-15 20:37:14

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

<key>NSPhotoLibraryUsageDescription</key>
<string>Photo Library Access Warning</string>

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):

<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app does not require access to the microphone.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>

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

Full List:

Apple Music:

<key>NSAppleMusicUsageDescription</key>
<string>My description about why I need this capability</string>

Bluetooth:

<key>NSBluetoothPeripheralUsageDescription</key>  
<string>My description about why I need this capability</string>

Calendar:

<key>NSCalendarsUsageDescription</key>
<string>My description about why I need this capability</string>

Camera:

<key>NSCameraUsageDescription</key>
<string>My description about why I need this capability</string>

Contacts:

<key>NSContactsUsageDescription</key>
<string>My description about why I need this capability</string>

FaceID:

<key>NSFaceIDUsageDescription</key>
<string>My description about why I need this capability</string>

Health Share:

<key>NSHealthShareUsageDescription</key>
<string>My description about why I need this capability</string>

Health Update:

<key>NSHealthUpdateUsageDescription</key>
<string>My description about why I need this capability</string>

Home Kit:

<key>NSHomeKitUsageDescription</key>
<string>My description about why I need this capability</string>

Location:

<key>NSLocationUsageDescription</key>
<string>My description about why I need this capability</string>

Location (Always):

<key>NSLocationAlwaysUsageDescription</key>
<string>My description about why I need this capability</string>

Location (When in use):

<key>NSLocationWhenInUseUsageDescription</key>
<string>My description about why I need this capability</string>

Microphone:

<key>NSMicrophoneUsageDescription</key>
<string>My description about why I need this capability</string>

Motion (Accelerometer):

<key>NSMotionUsageDescription</key>
<string>My description about why I need this capability</string>

NFC (Near-field communication):

<key>NFCReaderUsageDescription</key>
<string>My description about why I need this capability</string>

Photo Library:

<key>NSPhotoLibraryUsageDescription</key>
<string>My description about why I need this capability</string>

Photo Library (Write-only access):

<key>NSPhotoLibraryAddUsageDescription</key>
<string>My description about why I need this capability</string>

Reminders:

<key>NSRemindersUsageDescription</key>
<string>My description about why I need this capability</string>

Siri:

<key>NSSiriUsageDescription</key>
<string>My description about why I need this capability</string>

Speech Recognition:

<key>NSSpeechRecognitionUsageDescription</key>
<string>My description about why I need this capability</string>

@Daniel T. 2016-09-27 17:17:37

I have been using the string, "This app does not require access to the photo library."

@Dinesh Vaitage 2017-03-10 05:39:37

I have added key and string in info.plist file then i build app using terminal and all these changes has been removed. please guide on it

@fish40 2017-04-12 14:30:19

I added this but it still crashing with same error. Why this is happening?

@maverickosama92 2017-06-30 22:41:21

Thanks a lot. It worked like a charm.

@Anuj 2018-05-21 11:01:22

where to find info.plist file in ionic ? I am not able to get that.

@Syed Zain Ali 2018-08-28 08:03:58

Thanks alot , It work for me save my time .

@iOS 2018-02-08 06:30:19

https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html

"Privacy - Photo Library Additions Usage Description" for iOS 11 and later

"Privacy - Photo Library Usage Description" for iOS 6.0 and later

Open plist file and this code

<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>

<key>NSPhotoLibraryAddUsageDescription</key>
<string>This app requires access to the photo library.</string>

@Dinesh Vaitage 2017-03-06 12:43:21

Add following code in info.plist file

<key>NSPhotoLibraryUsageDescription</key>
<string>My description about why I need this capability</string>

enter image description here

@BvdVen 2017-07-31 17:58:34

This was exactly what I needed... with the source way I finally succeeded in uploading my app! TNX :)

@JohnV 2017-08-24 16:01:35

It's strange that this worked, but the other approaches didn't, maybe it's just a bug on xcode 9 beta. Many thanks for this!!!

@Dinesh Vaitage 2017-09-18 08:18:15

Welcome, Happy it's help to you.

@Bright Future 2017-02-18 10:06:33

MY FAVORITE WAY TO DO IT

1. Open info.plist

enter image description here

2. Click this button to add a new key

enter image description here

3. Scroll down to find Privacy - Photo Library Usage Description

enter image description here

4. Select it, then add your description on the right

enter image description here

@fish40 2017-04-12 14:31:16

I added this but it still crashing with same error. Why this is happening?

@Bright Future 2017-04-12 14:40:33

@fish40 maybe you can try clicking project-target-info, and add it there and see what happens?

@fish40 2017-04-13 07:04:40

@Brigt Future Thank you it worked

@Fareed Alnamrouti 2017-06-13 14:56:33

your key description made my day XD

@James Dunne 2017-12-08 11:54:57

Usage description tickled me. Fixed my issue too so happy bonus!

@Anuj 2018-05-21 11:00:50

where to find info.plist file ? I am not able to get that.

@Bright Future 2018-05-25 06:49:18

@Anuj if you can't find it, you might've deleted it. You can create a new one by File -> New -> File

@Ori 2016-09-28 09:02:56

For camera access use:

<key>NSCameraUsageDescription</key>
<string>Camera Access Warning</string>

Related Questions

Sponsored Content

5 Answered Questions

5 Answered Questions

[SOLVED] How to resolve "Missing Info.plist key ... NSPhotoLibraryUsageDescription"

  • 2017-01-12 11:24:09
  • Ale
  • 30560 View
  • 12 Score
  • 5 Answer
  • Tags:   ios cordova

1 Answered Questions

1 Answered Questions

[SOLVED] save downloaded image to camera roll with PHPhotoLibrary

  • 2017-11-26 17:08:11
  • Mick
  • 450 View
  • 1 Score
  • 1 Answer
  • Tags:   ios phasset

1 Answered Questions

[SOLVED] The info.plist in the package must contain the CFBundleVersion key

1 Answered Questions

[SOLVED] adding keys to info.plist in Xcode

  • 2017-08-22 08:33:43
  • adam.sellers
  • 864 View
  • 0 Score
  • 1 Answer
  • Tags:   react-native

1 Answered Questions

[SOLVED] App Rejected - Missing info.Plist key

  • 2017-07-24 20:51:13
  • justin rhoads
  • 931 View
  • 2 Score
  • 1 Answer
  • Tags:   ios iphone xcode

1 Answered Questions

iOS React Native app crashes NSPhotoLibraryUsageDescription

  • 2016-09-21 19:49:02
  • Jonathan Lockley
  • 378 View
  • 0 Score
  • 1 Answer
  • Tags:   ios react-native

Sponsored Content