Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will items in iOS keychain survive app uninstall and reinstall?

Tags:

ios

keychain

I am looking for documentation about the iOS keychain items. My specific question is if keychain items will survive an app uninstall and reinstall cycle. It seems to work that way since iOS 4 (or maybe even iOS 3), but I cannot find any documentation from Apple stating that this actually is supposed to work this way.

What I am trying to figure out is if I can TRUST (not "hope for" or "guess") that items in the keychain will survive the app uninstall.

EDIT: I realize that the question is a bit unclear as pointed out by Daij-Djan. What I am looking for is official documentation that backs up the well-known behaviour.

UPDATE 2017-04-04: See my answer below, the behaviour change in iOS 10.3 beta. It works as usual in iOS 10.3 but may probably change in future versions.

like image 219
Andreas Paulsson Avatar asked Sep 20 '13 07:09

Andreas Paulsson


People also ask

How do I reinstall an app without losing data iOS?

All you need is an Apple ID registered to another country where the app is available. Then sign in to iTunes with that Apple ID and get the app from the App Store. After that, use Xcode to install the downloaded app over the old one without erasing any data.

How do I delete app data from iPhone keychain?

Click Finder > Go > Utilities > Keychain Access. 2) In Keychain Access, select the Passwords category on the left to review the list of sites and services for which you've saved a password. 3) Right-click the service you want to edit/remove, then left-click Delete.

Can I delete keychain from iPhone?

You can't remove a keychain item from iOS device. The keychain is shared between applications, so another app could be using the same credentials. You should just leave the info alone when your app is removed. The keychain will persist even after the app is removed.


3 Answers

I dug around on the Apple developer forums, and a Apple developer (eskimo1, aka Quinn) states at 2012-08-27 that this is the current behaviour but it's a far as he knows not /documented/ behaviour, so this might change in the future. He also says that deleting shared keychain items is always going to be tricky, which is one of the reasons this it hasn't been addressed yet.

So I guess that this leaves the question open: there is no definitive answer. It is not documented and can change at any point in time. Relying on it MAY cause problems in the future.

UPDATE 2017-04-04:

In iOS 10.3 beta, keychain info for an app is removed when the app is uninstalled, but this behaviour seems to have been removed in the final 10.3 version. At Apple Documentation It is suggested that this is about to change and we should NOT rely on keychain access data being intact after an app uninstallation. See also iOS 10.3 beta 3 doesn't persist data of KeychainItem.

like image 146
Andreas Paulsson Avatar answered Oct 18 '22 00:10

Andreas Paulsson


Perhaps this is what you are looking for.
Apple Documentation

Note: On iPhone, Keychain rights depend on the provisioning profile used to sign your application. Be sure to consistently use the same provisioning profile across different versions of your application.

like image 36
user523234 Avatar answered Oct 18 '22 02:10

user523234


yes they will.

see a correspondinng question of mine:

How to find out WHEN a user bought the app / installed it for the first time (possible without UDID?)


AS I SEE IT:

'Officially' it is implied by the fact that the keychain is for multiple apps.. and that it 'belongs' to the os:

Apple Documentation

A keychain is an encrypted container that holds passwords for multiple applications and secure services.

=> ergo the keychain survives the app

PLUS

a keychain item can be shared between multiple apps

like image 26
Daij-Djan Avatar answered Oct 18 '22 02:10

Daij-Djan