This repository has been archived by the owner on May 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Passcode asked again even if the app is deleted and reinstalled #10
Comments
How did you achieve that? Can you share the code? |
@ggould75 if you post the code changes, or open a pull request, i'll add it to the demo app. sounds like an important feature to have |
i managed to do so anyway below is my code
|
I was doing something very similar: - (void)applicationDidFinishLaunching:(UIApplication *)application {
....
[[KKPasscodeLock sharedLock] setDefaultSettings];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"ApplicationRanBefore"] == NO)
[self _clearKeychainData];
....
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"ApplicationRanBefore"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
/**
* Call this method only if it is the first time the application is started!
* It will delete all the keychain data about the passcode if they are still existing.
* This avoid the passcode to be asked again if you have the passcode on, delete the app and reinstall it again
*/
- (void)_clearKeychainData {
BOOL passcodeOn = [[KKKeychain getStringForKey:@"passcode_on"] isEqualToString:@"YES"];
if (passcodeOn) {
BOOL res1 = [KKKeychain deleteStringForKey:@"passcode_on"];
BOOL res2 = [KKKeychain deleteStringForKey:@"passcode"];
BOOL res3 = [KKKeychain deleteStringForKey:@"erase_data_on"];
if (res1 == NO || res2 == NO || res3 == NO)
NSLog(@"Error deleting keychain data!");
}
} |
you can do it using my fork calling resetSettings |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I noticed that if you have the passcode ON and you delete the app and then reinstall it again, at the first launch the passcode is requested again.
This is because the passcode is still saved inside of the keychain.
I solved in this way: because my app had already a flag that said when it was launched for the first time, I used this flag also to check the existence of the passcode in the keychain. If it exists I delete it.
The text was updated successfully, but these errors were encountered: