Home:ALL Converter>Flutter IOS is not showing location permission dialog when using permission_handler package

Flutter IOS is not showing location permission dialog when using permission_handler package

Ask Time:2022-10-18T13:07:35         Author:Serenity

Json Formatter

How can I fix my flutter ios application not showing the permission dialog am currently using permission_handler 10.0.0 package the package works fine in android but on ios the dialog to either grant or deny the permission is not pop-up at all. Here is the function for the request

chkPermissionLoc(ctx) async {
var perLocation = await Permission.location.status;
    if (perLocation.isDenied) {
        await [Permission.location].request();//This isn't running
        print('Permission is Denied');
    } else if (perLocation.isGranted) {
      print('Permission is Granted');
    } else if (perLocation.isPermanentlyDenied) {
      print('Permission is permanently denied');
    } else if (perLocation.isRestricted) {
      print('Permission is OS restricted');
    } else if (perLocation.isLimited) {
      print('Permission is Limited');
    }
}

The application simply printed Permission is Denied but the function before it which is suppose to show the dialog is not getting called at all. I have added the string values in the info.plist file as per the documentation in the package but still the same issue.

    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Permission is Needed</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Permission is Needed 2</string>
    <key>NSLocationUsageDescription</key>
    <string>Permission is Needed 3</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Permission is Needed 4</string>

Any help will be greatly appreciated

Author:Serenity,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74105933/flutter-ios-is-not-showing-location-permission-dialog-when-using-permission-hand
yy