Question about 'identifierForVendor'

Hi all,


A question about identifierForVendor: I need to detect if an app is (re-)installed on an iPhone. Is it true that identifierForVendor changes when I delete the app from my iPhone and download it again from the App Store?


Thanks,

Rick

Answered by PBK in 270759022

It is unclear what you are asking.


>the user reinstall the app, I want to delete the 'old' Keychain data....is this possible with identfierForVendor?


You can use a changed identiferForVendor to indicate that the user has deleted all of your apps from their device. It is easier to use NSUserDefault (or any file) to indicate that the user has deleted your app from the device.


If you store the identifierForVendor in the keychain you can either use that old value or update that value in the keychain and use the new value.

Almost. It changes if the user deletes from a device all apps from the developer . It differs from device to device.


You may want to explore writing the identifierForVendor (or some other ID) to the keychain or the user's key-value file in their iCloud Account. Both of these spots are more durable.

Well, I store account information in the Keychain of the user. When he/she uninstall the app the data remains in the Keychain.

Lets say that 3 months later (for example) the user reinstall the app, I want to delete the 'old' Keychain data.


Is this possible with identifierForVendor?

It's not clear what you're trying to achieve. Why should reinstalling the app for the same user on the same device need to discard "old" account information? What if the app is being reinstalled after a device is wiped to solve some other problem? What if the app is deleted and restored from an older backup 3 months later? How you solve you problem depends on exactly what behavior you're trying to protect against.


That said, your app can easily tell if it's running for the first time after installation by checking for a custom file in its own app container. At the first run, the file won't exist and can be created.

Accepted Answer

It is unclear what you are asking.


>the user reinstall the app, I want to delete the 'old' Keychain data....is this possible with identfierForVendor?


You can use a changed identiferForVendor to indicate that the user has deleted all of your apps from their device. It is easier to use NSUserDefault (or any file) to indicate that the user has deleted your app from the device.


If you store the identifierForVendor in the keychain you can either use that old value or update that value in the keychain and use the new value.

NSUserDefault, of course! How can I forget that. Thanks!

Question about 'identifierForVendor'
 
 
Q