Failure to stop executing task in Xcode 4.3

谁说我不能喝 提交于 2019-12-03 01:17:44
yeahdixon

Found this post helpful XCode 4.3.2, issue with running on simulator

Strangely when it hangs, click on the simulator icon in the tray. Dont ask me why. This actually works

I can confirm this is still the case with Xcode 4.4 on Mountain Lion, unfortunately.

If I close the iOS simulator with Cmd+Q rather than leaving it open and stopping the simulation with the "Stop" button on the Xcode toolbar, the following things happen (although not systematically, but in 25% of the cases launching the same application - I believe this is related to application status but I have not understood how yet):

  • the "run" button in Xcode does not open a new iOS Simulator session; the "stop" button is still clickable but gives no result;
  • the toolbar continues to say "Running on iPhone simulator" no matter how many times you click "Stop";
  • if the iOS simulator is launched manually, it is not linked to the Xcode session;
  • not only does one have to re-start XCode: the restart has to be forced as the simple Xcode "Quit" command will not work.
Mick MacCallum

I've noticed this a lot since updating. The cure seems to be to just try to remember to stop the application from within Xcode while the simulator is still running the app. It seems like when you kill the simulator out from under Xcode your simulator process hangs and doesn't pass the termination message on to Xcode like it is supposed to.

Not really a solution, but I just overrode the “Quit iOS Simulator” keyboard shortcut in System Preferences to something I’m unlikely to type impulsively, like ⌘⌥Q.

I've been having a similar problem which can be resolved by restarting Xcode, but it's quite annoying. I've managed to get a workaround for this 'problem'.

  1. Go to ~/Applications/ and open the context menu for Xcode.app and select Show Package Contents

  2. Navigate to /Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/

  3. Copy iOS Simulator.app and paste it to (for instance) your Desktop

  4. Next start your OSX system preferences panel and navigate to Keyboard

  5. Select the second tab Keyboard Shortcuts

  6. Select Application Shortcuts on the left side

  7. Press the small + sign on the right side

  8. A small dialog appears.
    Select the copied iOS Simulator.app in the first selectbox > Other...

  9. As Menu Title fill in Home

  10. And for the menu shortcut 'type' COMMAND + Q

  11. Now hit Add and close your system preferences

  12. Delete iOS Simulator.app from your Desktop.

If you now start the simulator through Xcode and (accidentally) want to quit the simulator while it's running and attached to Xcode > you can't.

I know it doesn't fix the problem itself, but for those pro-users who use keyboard shortcuts for everything this might help a bit.

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