运行iPhone / iPad模拟器进行持续集成

我正在尝试从命令行运行iOS模拟器。 我已经find了iPhone模拟器可以运行的位置。 我的问题是它是否可以接收参数来指定哪个设备应该启动以及应该运行哪个应用程序。

$ ./Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone\ Simulator

有谁知道这是否有技巧。 了解更多这将有助于我们的持续集成过程。


我们现在使用WaxSim在CI构build期间自动化我们的iOS应用程序

使用-SimulateApplication参数在模拟器中运行可执行文件(在.app包中可执行文件)

(你也可以像这样从命令行编译项目:) xcodebuild -project Test.xcodeproj -arch i386 -sdk iphonesimulator

然后例如:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\Simulator.app/Contents/MacOS/iPhone\Simulator_SimulateApplication Test.app/Test

要么

./Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone \ Simulator -SimulateApplication Test.app/Test

要启动一个特定的设备,你可以这样做:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\Simulator.app/Contents/MacOS/iPhone\Simulator -SimulateDevice“iPhone Retina(3.5英寸)”

在Xcode 6的shell中试试这个

 osascript -e 'activate application "iOS Simulator"' 

对于Xcode 7

 osascript -e 'activate application "Simulator"' 

如果你想打开模拟器与特定的应用程序安装,那么你可以使用一些准备工具来启动模拟器。 这种方式很容易安装应用程序,并在模拟器上运行。 这是可以从terminal窗口运行的命令行工具。

  1. iPhoneSim
  2. IOS-SIM卡
  3. 其他与上面两个相同。

而主要的是所有使用相同的方法来打开模拟器。 (更多细节见项目)

其他方法(不推荐我)使用脚本文件从命令运行。

您可以使用xcrun simctl来列出可用的模拟器,启动应用程序等。此工具在Xcode 7和Xcode 8中均有提供。如果您不给它一个命令,它将打印命令行帮助。

xcrun simctl launch <UUID> <bundle id of app>将启动应用程序。

Interesting Posts