Crash on share sheet "save image" even though 1) write-only through share sheet 2) system could gracefully decline

Originator:mikexcite
Number:rdar://27988819 Date Originated:8/23/2016
Status:State:OpenProduct Resolved:
Product:iOS Product Version:
Classification: Reproducible:
 
Summary:
When trying out official Apple sample code, (https://developer.apple.com/library/prerelease/content/LucidDreams) in share sheet attempting to save photo got a crash and the following message in the debugger: 

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

This is just appalling. 

NOTE: NOT that to access photo library requires a usage description, the requirement is totally valid. 

But there are so many problems with crashing the app this way:

1) In this case, the app has passed the images off to the share sheet (UIActivityViewController) and that is trying to save an image to the photo library. The app is not trying to access the photo library. Saving an image in response to a user choosing "save image" from the share sheet is write-only action that shouldn't require special permission. *The whole point of the share sheet is that apps hand off content and the system directs it to where the user wants.*  
2) This is a very easy mistake to make, as evidenced by the fact it is present in Apple-provided sample code. The compiler should really check if UIActivityViewController is used and if there are not appropriate flags in the info.plist; this is perhaps a larger issue. 
3) Most crucially, *apps should never crash.* Especially if there's another option. Crashing the app is a terrible user experience, reflecting badly on both the developer and the iOS platform. 
I don't want to make assumptions about the thought behind this, but my understanding has been that Apple would not want apps to crash because that very bad user experience reflects badly on the platform--an app crashes users think less of the iPhone. Crashing the app because the developer failed to fill in a usage description is cutting off your nose to spite your face.    
In this case, the system could simply decline to perform the action (save image) and inform the user why in an alert.

Steps to Reproduce:
Run app that saves images. (example https://developer.apple.com/library/prerelease/content/LucidDreams). 
Attempt to share images. "Save Image." App crashes despite no warning. 

Expected Results:
1) Saving only -- In the case of simply saving photos to the library in response to users choosing from the share sheet (UIActivityViewController) to "save image," then NSPhotoLibraryUsageDescription should not be necessary for write-only. 
2) App does want to access the photo library -- System should simply decline to perform the action and inform the user why. Crashing the app is an always an appalling user experience that negatively impacts the user, negatively impacts the app, negatively impacts the developer and negatively impacts the iPhone experience. 

Actual Results:
Tapping "save image" app crashes, message why in debugger.

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!