我有这个代码显示重试按钮:
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>
3条答案
按热度按时间k4aesqcs1#
如果权限被永久拒绝,则只能从应用程序设置启用(除非重新安装应用程序)。您可以使用
openAppSettings
函数将用户重定向到设置。hmtdttj42#
本期在其回购协议中修复:https://github.com/Baseflow/flutter-permission-handler/issues/718#event-5560838657
3npbholx3#
根据权限处理程序的当前版本,您需要在
Podfile
和plist
两个文件中添加联系人权限,请确保您已添加此权限。