简体   繁体   English

如何通过 CLI 擦除 Xcode 10 模拟器克隆?

[英]How do I erase an Xcode 10 simulator clone through CLI?

Do they share the same UDID?它们共享相同的 UDID 吗? How are they implemented under the hood?它们是如何在幕后实施的?

The scenario is I have 4 clones running UI tests in parallel.场景是我有 4 个并行运行 UI 测试的克隆。 I need a clean simulator for some tests (but want to keep random test order)我需要一个干净的模拟器来进行一些测试(但想保持随机测试顺序)

Command to erase all testing simulators (you'll need to restart Xcode after that):擦除所有测试模拟器的命令(之后您需要重新启动 Xcode):

xcrun simctl --set testing delete all

Overall, it should be better to just reset those sims (you won't need to restart after that):总的来说,最好只重置这些 sims(之后你不需要重新启动):

xcrun simctl --set testing shutdown all
xcrun simctl --set testing erase all

To erase specific one you first need to get his ID with list devices and then shutdown and erase:要擦除特定的,您首先需要使用list devices获取他的 ID,然后关闭并擦除:

xcrun simctl --set testing list devices
xcrun simctl --set testing shutdown 2BC2B50E-C4BA-45B9-9C73-AF5097BA1F0B
xcrun simctl --set testing erase 2BC2B50E-C4BA-45B9-9C73-AF5097BA1F0B

Thanks Scott McCoy for his answer.感谢 Scott McCoy 的回答。

I have not been able to find any interface with cloned simulators via simctl .我无法通过simctl找到与克隆模拟器的任何界面。 You can completely remove them by deleting their folder under ~/Library/Developer/XCTestDevices .您可以通过删除~/Library/Developer/XCTestDevices下的文件夹来完全删除它们。 They each get their own UUID, but again, they don't get listed in simctl as far as I can tell.他们每个人都有自己的 UUID,但同样,据我所知,他们没有在simctl列出。

You can list clones like this: xcrun simctl --set testing list您可以像这样列出克隆: xcrun simctl --set testing list

But any time I try to use device IDs with xcrun commands they fail with Invalid device: <device id>但是每当我尝试将设备 ID 与 xcrun 命令一起使用时,它们都会失败并显示Invalid device: <device id>

On your status bar with Xcode open on your mac go to Windows->Devices and Simulators.在 Mac 上打开 Xcode 的状态栏上,转到 Windows->设备和模拟器。 There you will see a list of all the available simulators and you can add new or delete existing from there.在那里您将看到所有可用模拟器的列表,您可以从那里添加新的或删除现有的。

you can reset all the simulators by: xcrun simctl erase all您可以通过以下方式重置所有模拟器: xcrun simctl erase all

to reset a particular simulator use: xcrun simctl erase your_simulator_id重置特定模拟器使用: xcrun simctl erase your_simulator_id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM