Search code examples
iosobjective-csecuritytouch-idios9.2

How do I use the new iOS 9.2 Touch ID feature of "sequential finger detection"


From the release notes:

Support for reusable Touch ID matches. A match from the previous phone unlock can be used by evaluateAccessControl: and evaluatePolicy:localizedReason:reply:.

To me this means that an event CAN be fired if a different finger is being used.

Abstract Example:

  1. Login with finger 1, and again with finger 1, and again. No event.

  2. If finger 2 is used, event raised. Subsequent usage of finger 2 no event.

I do fully agree that I won't know what finger was used, just that a different one was used. This informaton might give me enough information to act upon.

Use Case

I'm creating an app to assist in domestic violence situations where if a victim is asked to unlock the touch-ID enabled app, and a different finger is used, then the call for help is discreetly erased from the app.

Research

This is not documented on Apple's site outside of release notes, and Diffs however it is present within Xamarin's site. I followed up with the developer forums and don't want to wait for the documentation bug to be acknowledged.

In my scenario, a device is shared between an Adult and a Child, both who are enrolled in TouchID. I need to determine if a different finger is being used to protect sensitive settings.

Question

How do I use LocalisedReasonReply to determine if a different finger was used to unlock a phone? (or am I misunderstanding the new feature)

[Foundation.Export("evaluateAccessControl:operation:localizedReason:reply:")]
public virtual Void EvaluateAccessControl (SecAccessControl accessControl,LAAccessControlOperation operation, String localizedReason, [ObjCRuntime.BlockProxy(typeof(ObjCRuntime.Trampolines/NIDActionArity2V1))]Action`2 reply)

For reference, I pasted the LAContext.h file here


Solution

  • "Support for reusable Touch ID matches..." mean that:-

    You can re-use device unlock authentication in your app by specifying time interval in evaluateAccessControl: and evaluatePolicy:localizedReason:reply: methods.

    By using LAContext Property "touchIDAuthenticationAllowableReuseDuration", You can reuse Device Unlock authentication in app, these is because at a time of device unlock you already authenticate your self. So it not required to authenticate again.(New Introduce iOS 9)

    Note: Time duration must be in seconds. it default value is '0' and you specify duration up to 5 Minutes, beyond 5 minutes does not increase the accepted interval.