- Introduction
Authentication for iOS is a biometric authentication library for iOS. It uses the LocalAuthentication framework.
2. Components in the Demo and what they do
The Demo is very simple. It contains one button that calls the authentication process. As well as TMemo that confirms whether the authentication is successful or not and one TPanel with a checkbox inside. The Checkbox gives a choice of whether to use a biometric or any other authentication. The Main execution that uses the Authentication library is on the button click. When the onClick event is called the TAuthentication class is created with two status events for Success or Error. Also, there is a checkbox that checks whether it’s checked or not to define the right authentication. You can see the entire process in the code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
procedure TFormMain.ButtonAuthenticateClick(Sender: TObject); var Error: TAuthenticationError; begin Authentication := TAuthentication.Create; Authentication.OnSuccess := OnSuccess; Authentication.OnError := OnError; if CheckBoxBiometric.IsChecked then Authentication.Policy := apBiometric else Authentication.Policy := apAny; if Authentication.CanEvaluatePolicy(Error) then Authentication.EvaluatePolicy('Log in to your account') else Memo.Lines.Add('Cannot evaluate policy: ' + Error.LocalizedDescription) end; |
If you want to see the Authentication Demo in action, please watch the next short video.
1 2 3 4 5 6 7 8 |
procedure TFormMain.OnSuccess(Sender: TObject); begin Memo.Lines.Add('Authentication success'); end; procedure TFormMain.OnError(Sender: TObject; Error: TAuthenticationError); begin Memo.Lines.Add('Authentication error: ' + Error.LocalizedDescription); end; |
The Demo can be downloaded here
With Rad Studio Native Ios App builder, you can use a library for authentication component in the component which supports the Delphi or C++ environments. Try the Product Demo here.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition