kill iOS Simulator from terminal

倖福魔咒の 提交于 2020-06-09 12:14:59

问题


I'm trying to terminate the iOS Simulator from the terminal console (needed for integrating automatic UI Testing in Jenkins),but every time I try the command:

killall SimulatorBridge

a prompt waiting for action gets displayed: enter image description here

The problem is that the simulator doesn't get dismissed until an action on the prompt is taken. How to get rid of it?


回答1:


Use killall "iPhone Simulator"

With XCode 6, use killall "iOS Simulator" (thanks @gempewsaw)

With XCode 7, use killall "Simulator" (thanks @Stanislaw)

With XCode 8, killing the Simulator process is sometimes not enough, also need to kill process com.apple.CoreSimulator.CoreSimulatorService (thanks @bensnider)




回答2:


The proper way to shutdown simulators is xcrun simctl shutdown all.

I don't recommend shutting down simulators by killing CoreSimulator.

Simulator.app is just a viewer (as of Xcode 9). It does not need to be launched and so does not need to be shut down either. It will respond to devices booting and shutting down automatically.

You can also hold down Option when quitting to detach from running simulators without shutting them down. Check the checkbox to make that the default behavior.

Similarly you can hold down Control when closing a window via File, Close to get a similar choice when closing a single simulator's window.




回答3:


I agree with the answers above. Just wanted to add that I noticed my Jenkins job was failing when there was no simulator to kill. I got around this by adding it like this:

killall "iOS Simulator" || echo "No matching processes belonging to you were found"

Good luck with your ci!




回答4:


Please try

killall -9 "iPhone Simulator"


来源:https://stackoverflow.com/questions/13648225/kill-ios-simulator-from-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!