如何从终端启动iOS模拟器?

时间:2015-07-02 08:45:44

标签: ios xcode terminal

我可以使用Xcode命令行工具构建,有没有什么方法可以使用它们实际运行应用程序? (例如,相当于在Xcode中按下Cmd + R)

9 个答案:

答案 0 :(得分:71)

首先确定您要使用的设备:

xcrun simctl list

这将为您提供设备列表:

-- iOS 9.0 --
    iPhone 4s (56632E02-650E-4C24-AAF4-5557FB1B8EB2) (Shutdown)
    iPhone 5 (ACD4DB7B-9FC9-49D5-B06B-BA5D5E2F5165) (Shutdown)
    iPhone 5s (A8358B76-AD67-4571-9EB7-FFF4D0AC029E) (Shutdown)
    iPhone 6 (1D46E980-C127-4814-A1E2-5BE47F6A15ED) (Shutdown)
    iPhone 6 Plus (FD9F726E-453A-4A4C-9460-A6C332AB140B) (Shutdown)

选择您想要的ID(例如FD9F726E-453A-4A4C-9460-A6C332AB140B)(如果需要,可以使用xcrun simctl create创建自己的设备。)

使用该设备启动模拟器(用ID替换YOUR-DEVICE-ID)

/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID <YOUR-DEVICE-ID>

现在您应该可以使用simctl来安装和启动命令。

xcrun simctl install <YOUR-DEVICE-ID> <PATH-TO-APPLICATION-BUNDLE>
xcrun simctl launch <YOUR-DEVICE-ID> <BUNDLE-ID-OF-APP-BUNDLE>

xcrun simctl help了解更多详情。请注意,使用simctl引导设备当前(Xcode 7.2)不允许您使用该设备执行任何其他操作,例如启动或安装应用程序。您需要在模拟器中启动设备以实际执行任何有趣的操作。此外,您无法删除模拟器正在使用的设备,因此您必须在尝试删除任何内容之前退出/终止模拟器。

答案 1 :(得分:57)

在终端输入:打开-a Simulator.app

答案 2 :(得分:21)

打开终端并粘贴此代码:

open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app

iOS Simulator Folder Path

答案 3 :(得分:20)

<description>
  Online Abonelik, Borç Sorgulama, Fatura Ödeme, Tüketim Sorgulama v.b. pek çok işlem
</description>

<author href="http://www.infopark.com.tr" email="bilgi@infopark.com.tr">
  Infopark
</author>

<preference name="permission" value="none" />

<plugin name="cordova-plugin-geolocation" spec="2.4.2" source="npm" />

<feature name="http://api.phonegap.com/1.0/geolocation" />


<preference name="orientation" value="default" />
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarBackgroundColor" value="#000000" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="detect-data-types" value="true" />
<preference name="android-windowSoftInputMode" value="adjustResize" />



<feature name="StatusBar">
  <param name="ios-package" value="CDVStatusBar" onload="true" />
</feature>


<preference name="phonegap-version" value="cli-6.5.0" />

<icon src="uedasicon.png" />

<preference name="SplashScreenDelay" value="5000" />

<gap:config-file platform="ios" parent="CFBundleShortVersionString">
  <string>107</string>
</gap:config-file>


<access origin="*" />


<gap:plugin name="cordova-plugin-whitelist" version="1.1.0" source="npm" />
<gap:plugin name="cordova-plugin-splashscreen" source="npm" />

<plugin name="cordova-plugin-whitelist" version="1" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="https://testoim.com.tr" />
<platform name="android">
  <allow-intent href="market:*" />
</platform>
<platform name="ios">
  <allow-intent href="itms:*" />
  <allow-intent href="itms-apps:*" />
</platform>

</widget>

对我有用

答案 4 :(得分:9)

自该日期起将生效:

open -a simulator 

这是最简单的方法。

答案 5 :(得分:5)

open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app/

答案 6 :(得分:3)

这是您寻找的答案:

  • 1.open终端
    1. xcrun simctl列表
    2. 了解要启动的设备
    3. 将其粘贴到终端机中
    4. 打开-a模拟器--args -CurrentDeviceUDID 0566AC33-9B91-2DR2-B5BB-C916D3BA8MD3

答案 7 :(得分:2)

对我来说xcrun simctl boot <udid>效果最好。

答案 8 :(得分:0)

#更新 在新的Xcode更新中,受支持的模拟器从 iPhone 8 开始

相关问题