How to delete Keychain data when app is uninstalled?
11,602
This is work around , but may be will satisfy you:
Store in NSUserDefaults
flag, that keychain have data.
If it's NO
then ignore keychain.
Author by
Paolpa
Updated on June 23, 2022Comments
-
Paolpa almost 2 years
I have a problem . I am saving some critical information on device Keychain for my App, but when I uninstall the App and install it again, these data is still saved. How can delete these information when the application is uninstalled? If this is not possible, how detect when the App is first Load after install it without save information in NSUserDefaults?
Thank you very much.
-
rckoenes over 10 years
NSUserDefault
are not secure, it makes more sense to store it in a more save place like heKeyChain
since theNSUserDefault
are just stored as plain text. -
Jeffery Thomas over 10 years@rckoenes I updated my answer. I think you want to use Data Protection.
-
Paolpa over 10 yearsThank you Jeffery Thomas, very good alternative!
-
orkoden about 10 yearsYou should not use NSUserDefaults for sensitive data like passwords or certificates.
-
Cy-4AH about 10 years@orkoden, anybody have said about storing passwords in NSUserDefaults? I am not.
-
Cy-4AH over 9 years@ta.speot.is. Thank you cap. Why -1?
-
Cy-4AH over 9 years@ta.speot.is, Have you minused answer in stackoverflow.com/questions/4747404/…? It's the same, but shorter.
-
ta.speot.is over 9 yearsSorry, I misread your answer. I can't take back my downvote because I downvoted you a few hours ago, but if you make a small edit to your answer I can upvote it.
-
ChuckZHB almost 3 yearsI disagree to save critical information in UserDefaults.