iosobjective-cxcodekeychainlocalauthentication

How to remove the stored username and password from keychain while uninstalling application in iOS?


I am pretty new to implement biometric authentication for my application and for my shopping application I am using the following logic to implement the same. Please bear with me if this is not the correct place to post this question. I ask moderators to move to the appropriate forum . As per now we are storing only username as AES encrypted format (not even in keychain).

I am able to implement the same successfully , but I have a query if I uninstall the application will they remove the stored credentials in keychain. I have referred many SO questions but I cannot a particular answer. If it remains there still after uninstalling application, how to remove these?


Solution

  • There is a post about this on the Apple developer forums. It basically tells us that the KeyChain is persistent even after app removal and reinstall (meaning the application can technically use the old keys again). This behaviour is not really as intended (if you read the thread carefully).

    To counter this behaviour, the forums provides a solution by setting a flag in the UserDefault storage (which is deleted when the app is uninstalled). When a user runs the app for the first time, clear the KeyChain and set the flag. That way, you can be almost certain that the keys were removed before first use.

    To answer your question directly, there is no way (as of right now) to tell when an app was uninstalled and act upon that uninstall.