Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you power-down an iPhone X in the Xcode simulator?

I run the Xcode Simulator on its own for web development testing. When Simulator starts up, it always boots up the iPhone X (iOS 11.3) because it was running when I last quit the simulator, because I can't figure out how to shut down the phone.

I can't hit the (virtual) power and volume buttons at the same time in the simulator (as one would do on a real phone) and for some reason the Settings > General area doesn't have the option to "Shut Down." I can restart the device from the Simulator's "Hardware" menu but there does not seem to be an option for shutting down the phone (even with extra keyboard modifiers held).

Have I missed anything or is this just not possible?

Clarifications:

  • I'm only running the simulator to use Safari on various platforms. There is no program instance to deactivate. Xcode is not running (or doesn't need to be running after the Simulator is launched from the Xcode menu). I have also tried launching, say, an iPhone 6S simulation from a compiled Xcode project but this only launches that hardware for that run. Next time I go directly into the Simulator, it remembers which hardware simulations were running and launches those.
  • I can select a different piece of hardware from the Hardware menu (e.g., iPhone 6S) but now I have two simulations running, which is resource intensive (and undesirable). I can shutdown the 6S because I can hold down the (virtual) power button to instruct the OS to perform its shutdown routine. But I can't shut down the iPhone X because there's no way (that I can find) to command the OS to shutdown like I can with anything else. The software method (in Settings) doesn't show in the simulator (for some strange reason) and the hardware method requires hitting two buttons at the same time. The net result is, now that I launched an iPhone X once, I always have to simulate an iPhone X + whatever I'm actually testing against.

Workaround Found

When Simulator is launched on its own (not though an Xcode project) it will re-launch the last simulation that was activated from the Hardware menu if it's left running. So if I launch something new, and then leave both it and the iPhone X simulator running, When I quit Simulator it will relaunch with the next time with new hardware, not the iPhone X.

I'd still be interested in any method to just tell the iPhone X hardware to shut down (if such a thing exists) as I'm often having to flip between hardware simulations and it would good to be able to do that without having to relaunch to get rid of iPhone X.

like image 254
Colin Avatar asked May 10 '18 16:05

Colin


People also ask

How do I turn off iPhone simulator?

Press Command + Q to quit the simulator. This will close all the apps running in the simulator. Pressing the home button only returns to the home screen without quitting the apps(ios 4 or later) because of multitasking.

How do I use Xcode iPhone simulator?

To run your app in Simulator, choose an iOS simulator—for example, iPhone 6 Plus, iPad Air, or iPhone 6 + Apple Watch - 38mm—from the Xcode scheme pop-up menu and click Run. Xcode builds your project and then launches the most recent version of your app running in Simulator on your Mac screen, as shown in Figure 1-1.

How do you restart an app on iPhone simulator?

shift+command+H twice to simulate the double tap of home button. swipe your app's screenshot upward to close it.

Why is there no iPhone X simulator in Xcode?

The problem is that you are using a @react-native/cli version that doesn't detect XCode 11 simulators. You can either downgrade your XCode or install a @react-native/cli that supports it.


1 Answers

Change your simulator to required version from Hardware -> Device -> That way you will have correct version loaded and of course there is no way of "Shutdown" a simulator but quit, as this is just an application not hardware. If you have multiple simulators open, you can close the not required ones by highlighting them and select File -> Close Window or CMD+W

Another good info from Colin :

I also just noticed that if I turn off "show device bezels" I get regular window controls for closing the window, too.

like image 162
Tushar Avatar answered Oct 29 '22 15:10

Tushar