Reset iOS Simulator application data to launch the application for the first time

I just finished writing code that checks if this is the first time the application is launched, and then displays a message if it is not the first time, and then displays another message.

How do you reset the simulator on Xcode so that I can test the application when it runs for the first time?

I tried to clear the build folder, but that didn't work.

+62
xcode ios-simulator
Apr 24 '13 at 15:20
source share
5 answers

In iOS Simulator, click iOS Simulator in the menu at the top of the screen and click " Reset Content and Settings ... ". This will clear the entire simulator.

Or, on the main screen of the simulator, delete the application in the same way as on the physical device by pressing and holding the application icon until β€œ x ” appears. top left and click "x" and select " Delete " from the warning view. This will clear all data associated with one application.

Then clean, build, and run.

+90
Apr 24 '13 at 15:23
source share

The correct way to do this in Xcode: (you must turn off the simulator first)

xcrun simctl erase <device UDID> or xcrun simctl erase all

To find out the UDID, use:

xcrun simctl list

+29
May 31 '16 at 3:54
source share

@ Answering a call is probably easier for interactive use.

We use scripts for automatic testing and delete the simulator data directory to ensure it is clean. The simulator recreates basic information at restart.

Delete the following:

~/Library/Application Support/iPhone Simulator/${simulator.version}

+4
Apr 29 '13 at 17:27
source share

Currently (Simulator Version 10.0) you can do this as follows:

Hardware> Delete All Content and Settings ...

The screenshot of the way to reset Simulator

+4
Aug 16 '18 at 19:53
source share

I don't know if this is really the best way, but the following works for me:

first kill all running simulators with

killall Simulator 2>&- && sleep 5 || true

then reset all devices with

xcrun simctl erase all

ps .: I work with Xcode 8

+1
May 11 '17 at 9:06
source share



All Articles