I have disabled the Photos permission for my app but when i query the status it is coming back as Granted...
This should be denied.
I am using the simulator on iOS 13.4
(Could this be a problem with the simulator? I dont have a real device to test on)
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
'PERMISSION_EVENTS=0',
## dart: PermissionGroup.reminders
'PERMISSION_REMINDERS=0',
## dart: PermissionGroup.contacts
'PERMISSION_CONTACTS=0',
## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=0',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=0',
## dart: PermissionGroup.speech
'PERMISSION_SPEECH_RECOGNIZER=0',
## dart: PermissionGroup.photos
# 'PERMISSION_PHOTOS=0',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=0',
## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=0',
## dart: PermissionGroup.mediaLibrary
'PERMISSION_MEDIA_LIBRARY=0',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=0'
]
And then i call this
status = await Permission.storage.status;
It says Granted.
This works fine on my android device just not the Ios Simulator.
Version:
permission_handler: ^5.0.1+1
Platform:
the same issue on simulator ios 13.5
I have a real device and tested that on it, and it seems same issue appears on real devices as well. Even when the user denies the access, "await Permission.storage.status" returns true
Oh that's not good, means it's an actual bug with the code.
Can the developers tell us where in the code to look for solving this bug?
It turns out, to request for galery permision on ios, you have to do it like the following:
Permission.photos.request(), not Permission.storage.request()
I discovered this article by coincidence and at the bottom of the page, it explains the difference of asking for permission on both ios and android devices.
Text from the site:
Some permissions such as contacts, calendar, microphone, location, etc. are common across iOS and Android. On the other hand, there are some permissions that either do not match up on both OSs. While others are just on one OS, i.e. storage, SMS, phone, etc. are only on android. You might want to determine which platform it is before requesting permission from the user.
Take a camera app, for instance, if you wanted photos to appear in the gallery, on iOS, you need photos permission while in android you need external storage permission.
var permission = Platform.isAndroid ? PermissionGroup.storage : PermissionGroup.photos;
And then, you can check if the user has granted your app permission:
await _permissionHandler.checkPermissionStatus(permission);
@N1ght-Fury, thanks for the explanation you've found in the article.
@febg11, did this solve your problem? If not please try to use the laters version of the plugin (6.1.1) and let us know if it did work, thanks in advance!
Most helpful comment
It turns out, to request for galery permision on ios, you have to do it like the following:
Permission.photos.request(), notPermission.storage.request()I discovered this article by coincidence and at the bottom of the page, it explains the difference of asking for permission on both ios and android devices.
Text from the site: