Will Items in iOS Keychain Survive App Uninstall and Reinstall

Will items in iOS keychain survive app uninstall and reinstall?

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.

iOS Keychain Data will persist after app deleted and reinstall?

Keychain data always persist now.

The auto-delete of keychain value was in a beta of 10.3, but for some reason, they removed this possibility. I guess to many applications get used to not droppable keychain.

Check this question.

There is a super simple way trough UserDefaults :

func clearKeychainIfWillUnistall() {
let freshInstall = !UserDefaults.standard.bool(forKey: "alreadyInstalled")
if freshInstall {
KeychainKeeper.shared.clear()
UserDefaults.standard.set(true, forKey: "alreadyInstalled")
}
}

Call it in AppDelegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.clearKeychainIfWillUnistall()
}

The simplest workaround that I know. I hope it will help.

iphone keychain items persist after application uninstall?

Yes, this is the expected and correct behavior.

Some keychain items may be shared with other apps you control (that share the same keychain item access group).

You should just leave the info alone when your app is removed. You have no callback or method of removing the keychain items on deletion of your app.

ios - how to prevent app from reinstalling

You can go with KeyChain, KeyChain will not removed after removing the application.(i.e. uninstalling application)

You can store your counts in Keychain and when the next time user install application you can get that user has used some trials.

Also

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.

Referenced from - here

iOS 10.3 about remove keychainData with the app deleted


does anyone know about the time of the solution.

Clearly when they release 10.3.

And will there has another method to replace keychain to save userData.

Of course not. Why would they implement a feature to improve user privacy and then introduce another feature to circumvent the change?

Will identifierForVendor change if I install and reinstall an application from the AppStore?

Yes it changes all the time for each and every installation. If you want to send same UUID to service all the time you have save the UUID in KeyChainStore provided the link below:
enter link description here

I have solved this problem with the help of the link provided above like this.

      NSString* identifier;
UICKeyChainStore *keychainStore = [UICKeyChainStore keyChainStore];
if(keychainStore[@"UDID"])
{
identifier=keychainStore[@"UDID"];
NSLog(@"output is : %@", identifier);
[SessionManager saveUDID:identifier];
}
else
{
identifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; // IOS 6+
NSLog(@"output is : %@", identifier);
keychainStore[@"UDID"] = identifier;
[SessionManager saveUDID:identifier];
}

+(void)saveUDID:(NSString*)udid
{
[[NSUserDefaults standardUserDefaults] setObject:udid forKey:@"UDID"];
[[NSUserDefaults standardUserDefaults] synchronize];
}

+(NSString*)getUDID
{
NSString *udid = [[NSUserDefaults standardUserDefaults]
stringForKey:@"UDID"];
return udid;

}
// logout from app
-(void)logOutFromApp
{

UIApplication*app=[UIApplication sharedApplication];
NSDictionary*dic;
AppDelegate *appDel = (AppDelegate *)[UIApplication sharedApplication].delegate;
[appDel application:app didFinishLaunchingWithOptions:dic];
[self.delegate logoutFired];

}

I hope it will help you. Happy Coding.



Related Topics



Leave a reply



Submit