So I'm still reasonably new to iOS development and I'm finding myself quite regularly needing to delete either DerivedData, or the contents of the iPhone Simulator directory, to get things to actually execute from my code. Clean in Xcode doesn't do the same as emptying those directories, right? And if not, is there an easier way to do it than lugging Finder around to get to them, and clearing them?
To clear your cookies and keep your history, go to Settings > Safari > Advanced > Website Data, then tap Remove All Website Data. To visit sites without leaving a history, turn Private Browsing on.
When you clear your iPhone's Safari cache, it means all the files, images, passwords, and scripts from websites you've visited recently will be wiped. To clear Safari's cache: 1. Open the Settings app and tap Safari.
Yes, there is a better way than going into every single simulator in town, and resetting contents and settings one at a time. Also much better than looking into your simulator's directory and yanking the cache from under its feet.
Quit iPhone Simulator, then run xcrun
in Terminal:
xcrun simctl erase all
Safe and effective.
See https://stackoverflow.com/a/26394597/218152 for single device
xcrun simctl erase [device ID]
In the iOS Simulator menu, there is an option called Reset Content and Settings...
This should do the trick.
EDIT:
To make this much quicker and easier, I added a shortcut key like this...
In System Preferences, choose Keyboard
Then choose the Shortcuts tab. And click App Shortcuts
Click the plus button to add another shortcut.
Lastly:
Now, while in your iOS Simulator, you can simply use your new shortcut key to reset.
If the Simulator doesn't appear in the drop down list:
Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With