Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i create an iOS simulator programatically on demand like in android(emulator)

In android i can create an emulator with android create avd and all the properties i want to have. Is there a way to do this in MacOs/Xcode via commands or can i only address the built-in simulators provided by xcode? If not, is there a way to start a simulator in MAcOs several times?

Background is automated testing and building an environment on demand. To be more clear: The need is a cluster of devices(simulator/emulator) to run tests in parallel. So i need to know if there is a way to have multiple simulators running of whatever instance i need. So when i want to test "iPhone 6" i need to have 10 instances to run my tests parallel to get a fast feedback in an agile continuous delivery background.

I didn't find anything in the internet so i guess the answer is no and no way.

Edit: Would at least be nice to leave a comment when downvoting

like image 821
Henning Luther Avatar asked Aug 03 '16 17:08

Henning Luther


1 Answers

Yes, what you want to do has been supported since Xcode 6 with the simctl command. Take a look at:

$ xcrun simctl create
Usage: simctl create &ltname> &ltdevice type id> &ltruntime id>

You can get a list of devicetype ids and runtime ids by running:

xcrun simctl list devicetypes runtimes

You can then boot them using xcrun simctl boot <device UDID>. Using Xcode 6.x and 7.x, such boots are limited in scope (can't install and launch apps, but you can spawn processes), but as of more recent Xcode 8 betas, they will boot to full sessions (although you can't interact with them using Simulator.app, they are great for use in automated test and build environments).

like image 114
Jeremy Huddleston Sequoia Avatar answered Nov 14 '22 20:11

Jeremy Huddleston Sequoia