I have observed behavior of app in iOS 10.2.1 device and iOS 10.3 beta 3 device for https://developer.apple.com/library/content/samplecode/GenericKeychain/Introduction/Intro.html
Keychain data is being deleted in iOS 10.3 beta 3. That was still found in earlier versions.
Do we have any alternative to do this?
Now that 10.3 has been officially released, it's been confirmed by several parties, including in this Apple's developers forum post, that this issue is not present in the final release.
Keychain data is not being deleted upon app's uninstall.
Originally (Since iOS 10.3 beta 1 to 5?) the keychain WAS NOT persisted.
Apple staff:
This is an intentional change in iOS 10.3 to protect user privacy. Information that can identify a user should not be left on the device after the app that created it has been removed.
But since iOS 10.3 beta 6, the keychain IS persisted again.
Nobody gives you any reassurances it will work that way in the future.
While it is fine to use it the way we do, I strongly encourage you to write your app so that it acts reasonably if this behaviour change.
As of iOS 10.3 beta 2 keychain information will be deleted when an app is deleted. Keychain information used to persist between app uninstall and reinstalls but that was not intended behavior and was a side effect of implementation that people got used to.
You'll probably just have to get used to the new behavior unless they have a top secret keychain replacement in the pipeline. keychain data should still persist since 10.3 beta 2 across app uninstall / reinstall by using an app group that shares said keychain info and having another application in the app group installed; so it doesn't delete the keychain info. Also I would guess it doesn't delete items synchronized with iCloud from iCloud but just deletes the local copy. Just a guess though.
Here is a link to an apple developer forum on the issue:
来源:https://stackoverflow.com/questions/42431562/ios-10-3-beta-3-doesnt-persist-data-of-keychainitem