I'm using TouchID to help users log into my app. Whenever the app is launched the first thing the user sees is the TouchID dialog.
My problem is that if a user launches my app while his finger is already on the home button - the user is immediately authenticated and only then the TouchID dialog is shown. Then - no matter what I do to dismiss the dialog (Enter Password or Cancel) the gray screen is always above my app and I have to restart my iPhone in order to continue working.
How can I solve this?
Ensure you only show the Touch ID dialog when the Application State is Active. If you display it immediately during the launch process (meaning the Application is still technically in an inactive state), then these sorts of issues can occur. This isn't documented, and I found this out the hard way.
For example, to ensure it runs when the application is active, you can check the current application state, and either run it immediately, or when we receive the applicationDidBecomeActive notification. See below for an example: