permanentlyDenied is being returned on iOS devices for Microphone permissionContact which seems to work fine.We discovered this today after adding microphone related permissions in our app. From the docs, permanentlyDenied is Android only, so unsure why are we even getting this on iOS devices.

Microphone Permission dialog must open
Our code goes through following askPermission function.
/// Asks for contact permission.
Future<void> askPermissions(Permission requestedPermission,
CompletionCallback completionCallback) async {
// Check permission status
PermissionStatus status = await requestedPermission.status;
// Request permission
if (status != PermissionStatus.granted &&
status != PermissionStatus.permanentlyDenied) {
status = await requestedPermission.request();
}
completionCallback(status);
}
Here is how we check for Microphone permission before making the call.
Future<void> ensurePermissionAndMakeCall(
BuildContext context, String phoneNumber) async {
await askPermissions(Permission.microphone, (status) async {
// status is always permanentlyDenied
// even just after user installs the application
});
}
Version: 1.x
permission_handler: ^7.1.0
Platform:
Looks like adding 'PERMISSION_MICROPHONE=1', in Podfile fixed this issue. Please feel free to close this bug, though plugin should still not return permanentlyDenied on iOS as documented.
@abhinavsingh this is on purpose since it makes the platform independent flow easier to understand:
PermissionStatus.denied means permissions are unknown or denied but you can try again;PermissionStatus.permanentlyDenied means permissions have been denied and the user should grant permissions through the OS "Settings" (permissions dialogs will not be shown when requesting permission).Otherwise you get in the situation where on Android PermissionStatus.denied means "permission status unknown or denied but you are allowed to request them" while on iOS the PermissionStatus.denied would mean "permission status denied, send the user to the Settings screen".
I agree that the documentation should be updated to reflect this correctly and is something I will work on. I will keep this issue open to track the progress on this.
I just released version 8.0.1 which contains updates on the API documentation explaining the PermissionStatus.permanentlyDenied is used on all platforms to indicate permissions can no longer be requested and should be acquired through the general settings.
Thanks for raising this issue and making me aware of the wrong documentation.
@mvanbeusekom The issue is still exist on iOS14.2 ! My permisstion_handler version is 8.1.2 .
@fisherjoe have you recently updated from version 7 or lower to version 8? Have you made sure you enabled the microphone permission in your Podfile (have a look here for more details)?