Reset keychain on the device

syntagma picture syntagma · May 2, 2013 · Viewed 48.7k times · Source

I'm testing login flow (using KeychainItemWrapper) inside my app on a device. How do I reset/delete keychain for my app?

On the Simulator, I do it by clicking on iOS Simulator -> Reset Content and Settings....

Answer

Will picture Will · Jun 30, 2014

Keychain items are in iOS sandbox, users don't have access to remove unwanted keychain item. These are accessible via API's only.

KeychainItemWrapper *keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:[[NSBundle mainBundle] bundleIdentifier] accessGroup:nil]; 

//or how you access your keychain

[keychainItem resetKeychainItem];

or you can reset your device >> from the device Settings, General, Reset, Reset All Settings. But, it will reset the keychain for every app installed on the device.