Will iOS clear an application's Keychain after the app is uninstalled? I seem to recall that an app's keychain items would be deleted by iOS some X days/hours/minutes after an app is deleted, however I can't find any reference to this behavior.
Edit:
So based on the thread below, it seems that the keychain survives an app uninstallation as a side effect of implementation. If so, it would seem that auto-deleting keychain items after app removal wouldn't be documented.
Re: iOS Keychain values survive to app uninstall
Out of curiousity, does anyone have insight into the observed behavior?
All versions of iOS prior to 10.3 beta preserve keychain items when an app is deleted.
10.3 beta included a change that deleted such items.
That caused compatibility problems (apps were relying on the existing behaviour, even though it wasn’t documented), so it was rolled back before 10.3 GM.
iOS 11 introduced the DeviceCheck framework, which provides a forward path for one of the most common legitimate use cases of this behaviour. For more info on this, see WWDC 2017 Session 702 Privacy and Your Apps.
Third, my specific advice:
If you want a keychain item to be deleted when your app is deleted, entangle it with a random key you store on disk, as described in my earlier post (11 Feb 2016). This is guaranteed to work regardless of how the OS behaves.
If you want the item to be preserved, start by looking at the DeviceCheck framework. If that allows you to achieve your high-level goal, you can adopt it on iOS 11 and later and then stop worrying about this issue.
If the DeviceCheck framework doesn’t meet your needs, please file an enhancement request explaining your situation and why DeviceCheck doesn’t work for you. I’d appreciate you posting your bug number here, just for the record.
If you continue to rely on the current behaviour, I strongly encourage you to write your app so that it acts reasonably if that behaviour changes.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
(1) Although there was a slide in WWDC 2017 Session 702 Privacy and Your Apps with bullet points like:
Will continue to remove entropy
Will continue to provide user control of entropy sources
Will continue to remove functionality that is being abused to uniquely identify users