-1

I want to call API on touchId authentication on a particular screen not on buttonAction or in ViewDidload.
Means if user pressing the home button touchId and if user is authorised it will Hit an API on a particular screen.

azeem usmani
  • 517
  • 4
  • 9
  • What about viewDidAppear? – D. Mika Mar 19 '19 at 13:08
  • sir, i can't apply it on any ViewCycle. – azeem usmani Mar 20 '19 at 05:07
  • Why not? You have to trigger the authentication somehow. You can *not* just have the user to touch the touchID sensor without calling the relevant API. The flow is: You call the API method, this shows the authentication UI, the user touches the touchID sensor, the API tells your app wether the user was able to authenticate or not. – D. Mika Mar 20 '19 at 10:32

1 Answers1

0

According to your case

not on buttonAction or in ViewDidload.

You can use the WillAppear life cycle function, but beware every time the user enter that UIViewController the function will trigger, take a look on other life cycle function here.

Means if user pressing the home button touchId and if user is authorised it will Hit an API on a particular screen.

I suggest implementing the TouchID on the required scene.

Mohmmad S
  • 5,001
  • 4
  • 18
  • 50
  • sir i have an attendance module to mark attendance we have an API provided by backend to mark attendance. we want that when user came to attendance screen he simply have to press TouchID on his device(homeScreen) and if user is authorised the API will call and his attendance will be marked . They are also showing previous record of attendance on the same screen so we can't implement TouchID on any ViewCycle. – azeem usmani Mar 20 '19 at 05:17
  • why you can't again ... how is showing something is preventing you from using viewCycle ? – Mohmmad S Mar 20 '19 at 05:41
  • because user don't have to give authentication to view anything on the same screen but only to mark attendance . – azeem usmani Mar 20 '19 at 06:54
  • .... use it in didload and go read about these cycle and why we use them – Mohmmad S Mar 20 '19 at 06:55