Flutter:iOS不要求权限

thtygnil  于 2023-02-13  发布在  Flutter
关注(0)|答案(3)|浏览(142)

我有这个代码显示重试按钮:

TextButton(
              onPressed: () async {
                await _checkPermission().then(
                  (hasGranted) {
                    if (hasGranted == PermissionStatus.granted) {
                      refreshContacts();
                    }
                  },
                );
              },

...

Future<PermissionStatus> _checkPermission() async {
    final Permission permission = Permission.contacts;
    final status = await permission.request();
    return status;
  }

这始终返回:

PermissionStatus.permanentlyDenied

但不会再次打开权限问题。
Info.plist:

<key>NSContactsUsageDescription</key>
    <string>This app requires access to display the contacts list. This will be used to import contacts automatically if necessary to the app contacts list.</string>
k4aesqcs

k4aesqcs1#

如果权限被永久拒绝,则只能从应用程序设置启用(除非重新安装应用程序)。您可以使用openAppSettings函数将用户重定向到设置。

hmtdttj4

hmtdttj42#

本期在其回购协议中修复:https://github.com/Baseflow/flutter-permission-handler/issues/718#event-5560838657

3npbholx

3npbholx3#

根据权限处理程序的当前版本,您需要在Podfileplist两个文件中添加联系人权限,请确保您已添加此权限。

相关问题