/test
我想根据错误类型处理else条件中的错误情况。
答案 0 :(得分:2)
您可以从返回的NSError
获取失败代码,并根据LAStatus
代码对其进行处理:
switch (error.Code)
{
case (long)LAStatus.AuthenticationFailed:
~~~
break;
case (long)LAStatus.UserCancel:
~~~
break;
~~~
default:
break;
}
public enum LAStatus : long
{
Success,
AuthenticationFailed = -1L,
UserCancel = -2L,
UserFallback = -3L,
SystemCancel = -4L,
PasscodeNotSet = -5L,
AppCancel = -9L,
InvalidContext = -10L,
BiometryNotAvailable = -6L,
BiometryNotEnrolled = -7L,
BiometryLockout = -8L,
NotInteractive = -1004L
}
有关各种代码的描述,可以使用LAError.Code: