xcode 允许面容 ID 权限提醒

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46853210/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:22:30  来源:igfitidea点击:

Allow Face ID permission alert

iosxcodeios11iphone-xface-id

提问by beebcon

My app (running in iPhone X Simulator Xcode 9.0.1) is asking me for permission to use Face ID.

我的应用程序(在 iPhone X Simulator Xcode 9.0.1 中运行)要求我获得使用面容 ID 的许可。

The alert says:

警报说:

Do you want to allow <appName> to use Face ID? This app was designed to use Touch ID and may not fully support Face ID.

Do you want to allow <appName> to use Face ID? This app was designed to use Touch ID and may not fully support Face ID.

I was expecting that the few changes I made to the new APIs in the LocalAuthenticationframework (e.g. biometryType) was supposed to basically work for Face ID.

我期待我对LocalAuthentication框架中的新 API 所做的一些更改(例如biometryType)应该基本上适用于 Face ID。

Is there something else I need to do to make it so my app isdesigned to fully support Face ID?

有没有别的东西,我需要做的,做起来很我的应用程序设计为完全支持面部识别?

回答by beebcon

It appears that you need to add the NSFaceIDUsageDescriptionto your Info.plistin order to support Face ID.

看来您需要添加NSFaceIDUsageDescription到您Info.plist的以支持面容 ID。

Also, the simulator alert is only for simulator, without that Info.plist key, the app apparently should crash on a real device without it.

此外,模拟器警报仅适用于模拟器,没有那个 Info.plist 键,应用程序显然应该在没有它的真实设备上崩溃。

Thanks to these dudes for helping me learn this - What is NSFaceIDUsageDescription - Face ID Usage Description Info.plist key?

感谢这些家伙帮助我学习 - 什么是 NSFaceIDUsageDescription - Face ID Usage Description Info.plist 键?



Protip:

专家提示:

Prior to the permission prompt, [LAContext canEvaluatePolicy:error:]returns YESfor biometrics if the device is capable of it.

在权限提示之前,如果设备有能力,[LAContext canEvaluatePolicy:error:]返回YES进行生物识别。

iOS won't prompt the user for permission until the first call to [LAContext evaluatePolicy:localizedReason:reply:].

在第一次调用[LAContext evaluatePolicy:localizedReason:reply:].

If the user does notgrant permission, then all future calls to canEvaluatePolicywill return NO(error Code=-6 "User has denied the use of biometry for this app."). This is an odd nuance.

如果用户授予权限,则所有未来调用都canEvaluatePolicy将返回NO(错误代码=-6“用户已拒绝为此应用程序使用生物识别。”)。这是一个奇怪的细微差别。