Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS iCL
How to verify if TouchID is available on the device

As soon as you add the LocalAuthentication component, you are bound to iOS 8.0. The component already internally checks if authentication is possible before executing it. There is currently no separate verification but if you want to verify if TouchID is available you can use the following code (it requires the FMX.TMSNativeUICore unit)
function TForm1.TouchIDAvailable: Boolean;
var
  ctx: LAContext;
  error: PPointer;
  auth: NativeInt;
begin
  result := False;
  ctx := TLAContext.Wrap(TLAContext.Wrap(TLAContext.OCClass.alloc).init);
  error := nil;
  auth := LAPolicyDeviceOwnerAuthenticationWithBiometrics;
  if ctx.canEvaluatePolicy(auth, error) then
    Result := True;
  ctx.release;
end;