ios - 如何在 Xcode 模拟器中关闭 iPhone X?
问题描述
我自己运行 Xcode Simulator 进行 Web 开发测试。当模拟器启动时,它总是启动 iPhone X (iOS 11.3),因为它在我上次退出模拟器时正在运行,因为我不知道如何关闭手机。
我无法在模拟器中同时按下(虚拟)电源和音量按钮(就像在真实手机上所做的那样),并且由于某种原因,“设置”>“常规”区域没有“关机”选项。 " 我可以从模拟器的“硬件”菜单重新启动设备,但似乎没有关闭手机的选项(即使持有额外的键盘修改器)。
我错过了什么或者这不可能吗?
说明:
- 我只运行模拟器以在各种平台上使用 Safari。没有要停用的程序实例。Xcode 未运行(或从 Xcode 菜单启动模拟器后不需要运行)。我也尝试过从已编译的 Xcode 项目启动 iPhone 6S 模拟,但这只会启动该运行的硬件。下次我直接进入模拟器时,它会记住哪些硬件模拟正在运行并启动它们。
- 我可以从“硬件”菜单中选择不同的硬件(例如,iPhone 6S),但现在我有两个正在运行的模拟,这是资源密集型的(并且不需要)。我可以关闭 6S,因为我可以按住(虚拟)电源按钮来指示操作系统执行其关闭程序。但是我无法关闭 iPhone X,因为(我能找到)没有办法像其他任何东西一样命令操作系统关闭。软件方法(在设置中)没有显示在模拟器中(出于某种奇怪的原因),而硬件方法需要同时按下两个按钮。最终结果是,既然我曾经推出过 iPhone X,我总是必须模拟 iPhone X + 我实际测试的任何东西。
找到解决方法
当 Simulator 自行启动时(不是通过 Xcode 项目),如果它保持运行,它将重新启动从 Hardware 菜单激活的最后一个仿真。因此,如果我启动新的东西,然后让它和 iPhone X 模拟器都运行,当我退出模拟器时,它将在下次使用新硬件时重新启动,而不是 iPhone X。
我仍然对任何告诉 iPhone X 硬件关闭(如果存在这种情况)的方法感兴趣,因为我经常不得不在硬件模拟之间切换,而且能够做到这一点而不必重新启动以摆脱 iPhone X。
解决方案
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.
推荐阅读
- mysql - 选择表中行对应的所有数据(SQL)
- android - 如何在 recyclerview 中隐藏特定项目并删除它的divideritemdecoration?
- macos - MacOS 命令行 - 一次创建包含文件的文件夹
- django - NoReverseMatch at / Reverse for 'snippet_detail' with arguments '('1534691562.8842607',)' not found
- javascript - 如何允许通过快递处理程序?
- java - GSON 获取嵌套对象
- html - 更新对象角度5+时如何将对象值保留在表单中?
- html - flexbox 外的按钮
- python - Python - 在不依赖“\n”的情况下很难连接多行
- assembly - 累加器中的值是多少?