I would like to know if there is a way to reset my app\'s Keychain. I am wondering whether anything like [NSUserDefaults resetStandardUserDefaults] exists for k
- (void)resetKeychainItem
{
OSStatus junk = noErr;
if (!keychainItemData) {
self.keychainItemData = [[NSMutableDictionary alloc] init];
} else if (keychainItemData){
NSMutableDictionary *tempDictionary = [self dictionaryToSecItemFormat:keychainItemData];
junk = SecItemDelete((CFDictionaryRef)tempDictionary);
if ( junk != noErr ) {
UIAlertView *dialog = [[UIAlertView alloc] initWithTitle:@"Keychain Error" message:[NSString stringWithFormat:@"A problem with updating the secure Keychain items with this information (likely, this email address information is duplicated in another Player). Error code: %d %@", junk, [self resultText:-junk]] delegate:self cancelButtonTitle:NSLocalizedStringFromTable(@"Ok", @"Localizable", @"display text") otherButtonTitles:nil];
[dialog show];
[dialog release];
//NSAssert( junk == noErr || junk == errSecItemNotFound, @"Problem deleting current dictionary." );
return;
}
}
// Default attributes for keychain item.
[keychainItemData setObject:@"" forKey:(id)kSecAttrAccount];
[keychainItemData setObject:@"" forKey:(id)kSecValueData];
[keychainItemData setObject:@"" forKey:(id)kSecAttrLabel];
[keychainItemData setObject:@"" forKey:(id)kSecAttrDescription];
[keychainItemData setObject:@"" forKey:(id)kSecAttrComment];
// Default data for keychain item.
[keychainItemData setObject:@"" forKey:(id)kSecAttrModificationDate];
[keychainItemData setObject:@"" forKey:(id)kSecAttrService];
}