PHPhotoLibrary authorizationStatus does not reflect authorization status for write-only permissions
| Originator: | tternes | ||
| Number: | rdar://34748647 | Date Originated: | 29-Sep-2017 05:14 PM |
| Status: | Open | Resolved: | |
| Product: | iOS + SDK | Product Version: | qua |
| Classification: | UI/Usability | Reproducible: | Always |
Summary: Applications that only require write-access to a user’s Photo Library appear to have no method for determining permissions programatically. In the past, applications could use +authorizationStatus on PHPhotoLibrary to determine permissions. In cases where permission had been denied, it was useful to explain that an application, such as a camera app, would not perform as expected unless permission was granted. However, with the addition of NSPhotoLibraryAddUsageDescription in iOS 11, along with the new behavior of UIImageWriteToSavedPhotosAlbum() displaying a system dialog, it appears to be impossible for an application to check for write-only permissions to the Photos Library. This causes a significant UX challenge in cases where the user launches the app, but is not looking at the screen when a photo is taken (like in camera apps with remote shutter control). A sample application that attempts to demonstrate this issue is attached. Steps to Reproduce: 1. Create an application that requires write-only access to the Photos Library. Include NSPhotoLibraryAddUsageDescription in the app’s Info.plist. 2. Use [PHPhotoLibrary authorizationStatus] to verify a freshly-installed application has a “not determined” authorization status. 3. Attempt to write an image to the user’s Photo Library with UIImageWriteToSavedPhotosAlbum(). Observe the system will display a permissions prompt. 4. Use [PHPhotoLibrary authorizationStatus] to observe the application still has a “not determined” authorization status, regardless of the user-provided permissions response. Expected Results: [PHPhotoLibrary authorizationStatus] should reflect the authorization status of applications requiring write-only access to Photos Library. Actual Results: [PHPhotoLibrary authorizationStatus] does not reflect authorization status if [PHPhotoLibrary requestAuthorization:] is never sent. Version: qua Notes: A few other notes related to this problem. If [PHPhotoLibrary requestAuthorization:] is sent without NSPhotoLibraryUsageDescription, the application crashes, even if NSPhotoLibraryAddUsageDescription is present. However, if +requestAuthorization is used and NSPhotoLibraryAddUsageDescription is present, then read-write access is requested. Then, +authorizationStatus correctly reflects the status, but write-only access has not been achieved, which my be adequate for the application’s needs.
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!
Sample app source: https://github.com/tternes/radars/tree/master/34748647-photo-permissions