How to reset a keychain in a simulator?

I saved some data in the simulator for important data. Now I have to check what happens if this data is not already present.

But I can not reset my keychain simulator to check this.

I tried to remove the application from the simulator and then create reset content and settings. But keychain data is still present.

Edit: YES, I EXCLUDE "RESET CONTENTS AND SETTINGS", but this does not work

+7
ios xcode6 ios-simulator
source share
2 answers

There is a race condition with content dumping, and settings sometimes do not work. If this does not work, try again. If it really does not work, exit Simulator.app, wait a few seconds, and then run "xcrun simctl erase" from the terminal. You can get the device UDID by running the "xcrun simctl list".

This race bug should be addressed in the latest version of Xcode 7.

+3
source share

The easiest way is to open your simulator and go to:

"iOS Simulator -> Reset Content and Settings" This will reset everything in the simulator and return it to the default settings.

If you want to do this with code, you can do it like this:

 NSArray *secItemClasses = @[(__bridge id)kSecClassGenericPassword, (__bridge id)kSecClassInternetPassword, (__bridge id)kSecClassCertificate, (__bridge id)kSecClassKey, (__bridge id)kSecClassIdentity]; for (id secItemClass in secItemClasses) { NSDictionary *spec = @{(__bridge id)kSecClass: secItemClass}; SecItemDelete((__bridge CFDictionaryRef)spec); } 
0
source share

All Articles