Chapter 30: Image Picker :: Page 699 Info.plist

Add an image Picker :: Page 699
Info.plist privacy changes

After adding keys & values to Info.plist

Privacy - Photo Library Usage Description; “Add photos to your locations.”
Privacy - Camera Usage Description; “Add photos to your locations.”

The book states that the user will be prompted an alert for both and have to select action OK.
The only time I managed to get a UIAlertController to pop up on a device & a simulator was for the Privacy - Camera Usage Description. Tested on a device & simulator running iOS 11 minimum

Apple Documentation supports this
-> Documentation > PhotoKit > PHPhotoLibrary > requestAuthorization(_:)

Important
Your app’s Info.plist file must provide a value for the NSPhotoLibraryUsageDescription key that explains to the user why your app is requesting Photos access. Apps linked on or after iOS 10.0 will crash if this key is not present.

I tested this and found I was able to remove the Privacy - Photo Library Usage Description entry and I still was able to access the Photo Library.

A post on –> stackoverflow explained that UIImagePickerController runs as a seperate process from the app. Therefore the app cannot see the whole Photos Library, and only gets read-only access to the user selected photo. The act of selecting a photo is the user granting the app permission access to that photo.

I believe this changed going from iOS 10 to iOS 11, or maybe to 11.2. It used to be required, and would still be if you wanted your app to run on iOS 10.

This topic was automatically closed after 166 days. New replies are no longer allowed.