How to add NSPhotoLibraryUsageDescription key in XCode for an iOS project

Introduction :

NSPhotoLibraryUsageDescription key was introduced in iOS 10. This key should be included in all iOS project if the app is accessing the user’s photo library. In this post, I will show you how to add this key to an XCode project.

Steps to do that :

We need to add NSPhotoLibraryUsageDescription in the info.plist file. Follow the below steps for that :

Step 1 :

Click on the root file and click on the Info tab.

ios NSPhotoLibraryUsageDescription

Step 2 :

Expand the Custom iOS Target Properties tab.


Step 3 :

Right-click on any key row and click on Add Row.


Step 4 :

Add the key as NSPhotoLibraryUsageDescription with type String with value as the description. It will automatically change the key name to Privacy - Photo Library Usage Description. NSPhotoLibraryUsageDescription

The value of the key will be shown as a description of the popup shown to the user. So, write the value describing why your application needs access to the photo library.