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.