如何重置 Xcode 机器人使用的模拟器?

How do I reset the simulator used by an Xcode bot?

我正在使用的模拟器实例在持续集成运行后有时会留在inconsistent state中,我该如何重置它?

重置构建服务器上普通用户帐户中 运行 的模拟器似乎不会重置机器人使用的模拟器(运行 在受限_xcsbuild 个用户。)

this gist 的启发,运行 此脚本作为您的机器人上的 "Before Integration" 触发器:

/usr/bin/osascript -e 'tell application "iOS Simulator" to quit'
/usr/bin/osascript -e 'tell application "Simulator" to quit'
/usr/bin/xcrun simctl erase all

... 并欺骗雷达 24091918 以将 "all" 作为有效参数添加到 xcrun simctl shutdown