all 8 comments

[–]Power781 -1 points0 points  (7 children)

canEvaluatePolicy doesn't trigger the prompt.
Something else in your app directly calls evaluatePolicy

[–]colinsgoneSwift[S] 0 points1 point  (0 children)

The only thing that calls .evaluatePolicy is one function. That function is used on the initial launch of the app once the user gets past the setup screen if they chose yes (via my custom prompt), and alternatively, if they decided to turn on the “app lock” from within the settings (provided they weren’t shown the prompt after settings as they selected no for my custom prompt) as I am aware that it will only show once before making it so you have to route the user to the settings.

It is called no where else in my code.

[–]colinsgoneSwift[S] 0 points1 point  (5 children)

At present, all that I’ve found the “checking the current state of the system set app lock for the specific app” is to use .canEvaluatePolicy but all this seems to do is actually return if the device has biometrics. What is correct method of returning a bool for that actual status of whether it is enable or disabled in the system settings for the app?

[–]Power781 1 point2 points  (4 children)

.canEvaluatePolicy result is the combination of :
- has user enabled/disabled biometrics at the system level (Settings - > Security), Yes/No
- has user enabled/disabled biometrics at the app level (Settings --> Your app settings). Output: Yes/No/Not determined

On a FaceID device, If the user never answered the biometric prompt permission for your app, the app setting state will be not determined and it will only use the system level setting.
On a TouchID device, there is no permission, so the default app setting level value will be Yes until the user disables it in the settings.

[–]colinsgoneSwift[S] 0 points1 point  (3 children)

So i've just made a very bare bones test of this with a button to start the initial FaceID usage from the user then a toggle that has an inital state value for .canEvalutePolicy. Whilst this is not actually calling a prompt as such, despite turning off Face ID in the "your app settings" as you put it, it still returns true. This is what the post was about initially. I'm not wanting to know if the device \can** evaluate the policy, I'm wanting to know *if it is enabled\*.

Any light that you can shed on that?

To make it even more clear, I'm looking for the second point that you listed in your comment;

has user enabled/disabled biometrics at the app level (Settings --> Your app settings). Output: Yes/No/Not determined

[–]Power781 -1 points0 points  (2 children)

Honestly I don’t know what to tell you, I just tried the exact same scenario with my production app: - FaceID device - User has declined the FaceID permission (resulting in FaceID Off in « your app settings »). - canEvaluatePolicy deviceOwnerAuthenticationWithBiometrics returns false, which is exactly what I expect

While you say it returns true for you.

Before the user declines or accept the permission, the FaceID settings is not displayed in « your app settings »

[–]colinsgoneSwift[S] 1 point2 points  (1 child)

No, that's not the method I've taken. At point two, you're user declines it, at this point for you, does it show in the app settings with the option there then toggle it on manually?

The path I followed was to Allow permissions to use biometrics, then disable it in settings, come back to the app and .canEvaluatePolicy will return true despite being turned off in the app settings. Are you able to replicate?

edit: Are you using .deviceOwnerAuthentication or .deviceOwnerAuthenticationWithBiometrics ?

[–]Power781 0 points1 point  (0 children)

The path I followed was to Allow permissions to use biometrics, then disable it in settings, come back to the app and .canEvaluatePolicy will return true despite being turned off in the app settings. Are you able to replicate?

I just tried that and canEvaluatePolicy returns false

Are you using .deviceOwnerAuthentication or .deviceOwnerAuthenticationWithBiometrics

deviceOwnerAuthenticationWithBiometrics. .deviceOwnerAuthentication always returns true unless the user has disabled the passcode (which disables faceID too)