Created
May 24, 2018 21:22
-
-
Save bryanjclark/da9cd521103ce8dd25662b233b71c2e9 to your computer and use it in GitHub Desktop.
iOS: Clearing out old keychain if app is re-installed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Clear keychain on first run in case of reinstallation | |
if (![[NSUserDefaults standardUserDefaults] objectForKey:@"FirstRun"]) { | |
// Delete values from keychain here | |
if ([[BXTAccountManager sharedAccountManager] authenticatedAccounts]) { | |
[[BXTNotificationsManager sharedNotificationsManager] removeAllAccountsFromServer]; | |
} | |
[[BXTAccountManager sharedAccountManager] clearKeychain]; | |
NSLog(@"Clearing keychain"); | |
[[NSUserDefaults standardUserDefaults] setValue:@"1strun" forKey:@"FirstRun"]; | |
[[NSUserDefaults standardUserDefaults] synchronize]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment