在运行 Snow Leopard 的旧 Mac 上,我可以在聚光灯下输入“ios”,它会自行启动 iPhone/iPad 模拟器。
此后我不得不购买一台运行 Lion 的新机器。我已经安装了 Xcode for Lion,我已经从首选项面板安装了开发人员工具选项。
但是“ios”选项不再存在:(现在唯一的方法似乎是运行 Xcode,创建一个空项目,然后使用运行选项启动模拟器。
我在互联网和 Facebook 上搜索了又搜索,但没有任何帮助。
有人知道如何在 Lion 上只运行模拟器吗?
更新: 回应下面的@ike_love 线程。 该答案不能保证在所有 Yosemite 机器上都有效。
最佳答案
假设您已在 /Applications
中安装了 Xcode,那么您可以从命令行执行以下操作来启动 iPhone 模拟器:
$ open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
(Xcode 6+):
$ open /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app
您可以从桌面创建一个符号链接(symbolic link)以简化此操作:
$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ~/Desktop
(Xcode 6+):
$ ln -s /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app ~/Desktop
正如@JackHahoney 所指出的,您还可以向您的~/.bash_profile
添加一个别名
:
$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
(Xcode 6+):
$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app'
(Xcode 7+):
$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app'
这意味着您可以使用一个易于记住的单词从命令行启动 iPhone 模拟器:
$ simulator
关于xcode - 如何在不启动 Xcode 的情况下运行 iPhone 模拟器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10379622/