apache / apache/cordova-plugin-camera
[IOS] All photos are available even though only some photos are allowed to access
- Dominant language
- Objective-C
- Stars
- 976
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
# Bug Report
## Problem
In IOS, when accessing the gallery, there is a dialog and the user needs to choose an option to grant access gallery permission to the application. If the user chooses "Select more photos...", there is a view for him/her to select which photos can be accessed. However, after that, in the next view, where the user can select a photo to import to the application, the user can access all photos in the gallery instead of only selected photos in the previous view => Granting read access for some photos does not work.
### What is expected to happen?
When the user selects photos in the gallery to import to his/her application, only some photos, that are granted access, will be displayed.
### What does actually happen?
When the user selects photos in the gallery to import to his/her application, all photos are displayed regardless ungranted access permission
## Information
The [requestPhotoPermissions](https://github.com/apache/cordova-plugin-camera/blob/master/src/ios/CDVCamera.m#L487) method in **CDVCamera.m** is using deprecated API from **PHPhotoLibrary**: **authorizationStatus** and **requestAuthorization**. These 2 deprecated methods cannot return the correct value when the user chooses the "Select more photos..." option. 2 alternative methods for those are: **authorizationStatusForAccessLevel** and **requestAuthorizationForAccessLevel**, which can return the correct value: **PHAuthorizationStatusLimited** instead of **PHAuthorizationStatusAuthorized**.
### Environment, Platform, Device
Iphone 14 (IOS 16.6)
### Version information
- Cordova: 12.0.0
- Cordova-ios: 7.0.0
- Cordova-plugin-camera: 7.0.0
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Assessment
This issue has not been assessed yet.