简体   繁体   English

local_auth iOS(扑)

[英]local_auth iOS (Flutter)

Flutter local_auth didn't return platform exception when biometrics and passcode are disable for iOS. Flutter 当为 iOS 禁用生物识别和密码时,local_auth 没有返回平台异常。

I have a functionality where if biometrics and passcode are disable, I will use another function for authentication but it only works on Android and didn't work on iOS.我有一个功能,如果生物识别和密码被禁用,我将使用另一个 function 进行身份验证,但它只适用于 Android 而不适用于 iOS。

Future<bool> authentication() async {
    try {
      return await _localAuthentication.authenticate(
        localizedReason: Strings.localAuthReason,
        useErrorDialogs: true,
        stickyAuth: true,
      );
    } on PlatformException {
      return false;
    }
  }

import this code below import 'package:local_auth/error_codes.dart' as local_auth_error;导入下面的代码 import 'package:local_auth/error_codes.dart' as local_auth_error;

and try this试试这个

 Future<bool> authentication() async {
try {
  return await _localAuthentication.authenticate(
    localizedReason: Strings.localAuthReason,
    useErrorDialogs: true,
    stickyAuth: true,
  );
} on PlatformException catch (exception) {
  if (exception.code == local_auth_error.notAvailable ||
      exception.code == local_auth_error.passcodeNotSet ||
      exception.code == local_auth_error.notEnrolled) {
    // Handle this exception here.
  }
}

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为local_auth Flutter添加自定义对话框 - Adding custom dialog for local_auth Flutter 如果你想用它来保护整个应用程序(例如银行应用程序),你如何在 flutter 中正确配置 local_auth? - How do you configure local_auth in flutter correctly if you want to secure the whole app with it (e.g. bank apps)? Firebase auth 不在 iOS 或 ZC047B10EEE763AFB6164E077CFCC12 中的 Android 上持续存在 - Firebase auth not persisting on iOS or Android in Flutter 在 ios flutter 上实现 firebase 匿名身份验证 - implementing firebase anonymous auth on ios flutter 如何将本地框架添加到iOS的Flutter插件中 - How to add a local framework to a Flutter plugin for iOS 如何在Flutter应用程序上使用iOS显示本地通知? - How to display local notifications with iOS on Flutter application? Flutter 本地通知,自定义声音不适用于 iOS - Flutter local notifications, custom sound not working for iOS Flutter 本地通知在 IOS 上未按预期工作 - Flutter local notification is not working as expected on IOS Flutter - 插件,如何依赖 ios 本地 pod - Flutter - Plugin, how dependency a ios local pod 从未设置 Firebase 电话身份验证验证 ID。 (颤振iOS) - Firebase Phone Auth verificationId never being set. (Flutter iOS)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM