Run iPhone/iPad Simulator for Continuous Integrati

2019-01-16 11:49发布

I am attempting to run the iOS simulator from the command line. I have found the location where the iPhone Simulator can be run from. My question is whether or not it can receive parameters to specify which device should be launched and what app it should run.

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

Does anyone know if there are tricks to this. Knowing more about this would really help with our Continuous Integration process.


We now use WaxSim to automate our iOS applications during CI Builds

5条回答
疯言疯语
2楼-- · 2019-01-16 12:11

If you want to open Simulator with specific app installed then you can use some of the ready utility to launch simulator. This way it is easy to install the app and run on the simulator. This are the command line utilities that can be run from Terminal Window.

  1. iPhoneSim
  2. ios-sim
  3. Other are same as above two.

And main thing is all uses same approach to open simulator. (see the project for more details)

Other way (not recommended by me) use script file to run from command.

查看更多
老娘就宠你
3楼-- · 2019-01-16 12:15

Use the -SimulateApplication argument to run your executable in the simulator (executable inside the .app bundle)

(you could also compile the project from the command-line like this:) xcodebuild -project Test.xcodeproj -arch i386 -sdk iphonesimulator

Then for example:

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

or

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

查看更多
聊天终结者
4楼-- · 2019-01-16 12:20

You can use xcrun simctl to list available simulators, launch applications, etc. This tool is present in both Xcode 7 and Xcode 8. If you don't give it a command it will print command line help.

xcrun simctl launch <UUID> <bundle id of app> will start the application.

查看更多
Juvenile、少年°
5楼-- · 2019-01-16 12:21

Try this in your shell for Xcode 6

osascript -e 'activate application "iOS Simulator"'

For Xcode 7

osascript -e 'activate application "Simulator"'
查看更多
时光不老,我们不散
6楼-- · 2019-01-16 12:25

To launch a specific device you can do:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateDevice "iPhone Retina (3.5-inch)"

查看更多
登录 后发表回答