Clear out NSUserDefaults during backup restore.

pull/1/head
Matthew Chen 7 years ago
parent 67197ddf15
commit 05b034e925

@ -754,6 +754,11 @@ NSString *const Keychain_ImportBackupKey = @"ImportBackupKey";
return NO;
}
// Clear out any existing keys in this instance of NSUserDefaults.
for (NSString *key in userDefaults.dictionaryRepresentation) {
[userDefaults removeObjectForKey:key];
}
// TODO: this doesn't yet remove any keys, so you end up with the "union".
for (NSString *key in dictionary) {
id value = dictionary[key];
@ -761,6 +766,8 @@ NSString *const Keychain_ImportBackupKey = @"ImportBackupKey";
[userDefaults setObject:value forKey:key];
}
[userDefaults synchronize];
return YES;
}

Loading…
Cancel
Save