UIImageWriteToSavedPhotosAlbum crashes with permission error even though NSPhotoLibraryUsageDescription is specified in Info.plist, requiring NSPhotoLibraryAddUsageDescription to be defined as well

Originator:kasper.muncken
Number:rdar://41246623 Date Originated:19/6-2018
Status:Open Resolved:
Product:UIKit Product Version:iOS 11, 12
Classification:Crash Reproducible:Always
 
Area:
UIKit

Summary:
Using UIImageWriteToSavedPhotosAlbum() to write a UIImage to the user's photo library crashes the app even though ab NSPhotoLibraryUsageDescription is specified in the app's Info.plist.

This behaviour is inconsistent with the information provided in the documentation regarding the key, i.e. "[...] this keys governs read and write access to the user’s photo library" (https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW73).

Specifying an NSPhotoLibraryAddUsageDescription fixes this crash. However, according to the docs, both keys are not required to use this function.

Steps to Reproduce:
- Run provided sample project
- Tap the "Save to Camera Roll" button

Expected Results:
The sample.png image is saved to the device's photo library.

Actual Results:
The app crashes with the following error: "This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data."

Version/Build:
XCode 10 (10L176w)
Verified on iPhone 7 running 15F79 and iPhone 6S+ running 16A5288q

Configuration:
-

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!