Source:
<code>public void resetContentAndSettings() { if (instrumentsVersion.getMajor() < 6) { if (hasContentAndSettingsFolder()) { boolean ok = deleteRecursive(getContentAndSettingsFolder()); if (!ok) { System.err.println("cannot delete content and settings folder " + contentAndSettingsFolder); } } boolean ok = contentAndSettingsFolder.mkdirs(); if (!ok) { System.err.println("couldn't re-create: " + contentAndSettingsFolder); } } else { DeviceUUIDsMap uuidsMap = new DeviceUUIDsMap(); uuidsMap.loadData(); String uuid = uuidsMap.getUUID(exactSdkVersion, deviceName); if (uuid == null) { System.err.println("Unable to get UUID for device " + deviceName + " with SDK " + exactSdkVersion); } List<String> simctlArgs = new ArrayList<>(); simctlArgs.add("xcrun"); simctlArgs.add("simctl"); simctlArgs.add("erase"); simctlArgs.add(uuid); Command simctlCmd = new Command(simctlArgs, true); int exitCode = simctlCmd.executeAndWait(true); if (exitCode == 146) { log.log(Level.WARNING, "Reset content and settings exit code = " + exitCode + ", possibly device is in booted state, shutdown device = " + uuid); simctlArgs = Arrays.asList("xcrun", "simctl", "shutdown", uuid); simctlCmd = new Command(simctlArgs, true); exitCode = simctlCmd.executeAndWait(false); <START> ClassicCommands.killall("iOS Simulator"); <END> simctlArgs = Arrays.asList("xcrun", "simctl", "erase", uuid); simctlCmd = new Command(simctlArgs, true); exitCode = simctlCmd.executeAndWait(false); } else if (exitCode != 0) { throw new WebDriverException("execution failed. Exit code =" + exitCode + " , command was: " + simctlCmd.commandString()); } } }</code><technical_language>need this. erase contents simulator state changed "Booted" "Shutdown"</technical_language>

Target:
public void resetContentAndSettings() { if (instrumentsVersion.getMajor() < 6) { if (hasContentAndSettingsFolder()) { boolean ok = deleteRecursive(getContentAndSettingsFolder()); if (!ok) { System.err.println("cannot delete content and settings folder " + contentAndSettingsFolder); } } boolean ok = contentAndSettingsFolder.mkdirs(); if (!ok) { System.err.println("couldn't re-create: " + contentAndSettingsFolder); } } else { DeviceUUIDsMap uuidsMap = new DeviceUUIDsMap(); uuidsMap.loadData(); String uuid = uuidsMap.getUUID(exactSdkVersion, deviceName); if (uuid == null) { System.err.println("Unable to get UUID for device " + deviceName + " with SDK " + exactSdkVersion); } List<String> simctlArgs = new ArrayList<>(); simctlArgs.add("xcrun"); simctlArgs.add("simctl"); simctlArgs.add("erase"); simctlArgs.add(uuid); Command simctlCmd = new Command(simctlArgs, true); int exitCode = simctlCmd.executeAndWait(true); if (exitCode == 146) { log.log(Level.WARNING, "Reset content and settings exit code = " + exitCode + ", possibly device is in booted state, shutdown device = " + uuid); simctlArgs = Arrays.asList("xcrun", "simctl", "shutdown", uuid); simctlCmd = new Command(simctlArgs, true); simctlCmd.executeAndWait(false); simctlArgs = Arrays.asList("xcrun", "simctl", "erase", uuid); simctlCmd = new Command(simctlArgs, true); simctlCmd.executeAndWait(false); } else if (exitCode != 0) { throw new WebDriverException("execution failed. Exit code =" + exitCode + " , command was: " + simctlCmd.commandString()); } } }