Skip to content

Instantly share code, notes, and snippets.

@miromasat
Created October 31, 2014 15:34
Show Gist options
  • Save miromasat/993b754bdeb6fd6d67cd to your computer and use it in GitHub Desktop.
Save miromasat/993b754bdeb6fd6d67cd to your computer and use it in GitHub Desktop.
This was an only solution for debugging Ionic apps for me.
#!/bin/bash
# Manually emulate ionic/cordova application
# Miroslav Masat 2014
echo "Emulating..."
cd ./platforms/ios/build/emulator
var=$(pwd)
ios-sim launch "$var"/*.app
@miromasat
Copy link
Author

usage:
setup application the standard way

$ ionic start myApp tabs
$ cd myApp
$ ionic platform add ios
$ ionic build ios

Then create a file called emulate.sh in that directory and copy the content of this gist into it. Next you have to set permissions for this shell script.

$ sudo chmod 777 emulate.sh

After that, each time you want to emulate your application in iOS simulator, just run: ./emulate.sh

I hope this works for you. Enjoy!

@snehoo
Copy link

snehoo commented Nov 25, 2014

Cool, this works great, now how do i change device type, changing that doesnt reload the app, what changes are required in the script for it to open in multiple device types?

Thanks

@dpi627
Copy link

dpi627 commented Dec 25, 2014

It's work for me, too. Really solved my emulate failed problem.

Thanks

@shunkurosaki
Copy link

It's works really well. Thanks so much.

@apostoiis
Copy link

Yeap, for me too. Thanks a lot. 😄

@Chener
Copy link

Chener commented Feb 13, 2015

Why this did not work for me, it showed:

Emulating...
Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7fcf80408180 {NSLocalizedDescription=Simulator session timed out.}

I tried sudo.

@chmartinez
Copy link

Same error as @Chener.
Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out." UserInfo=0x7ff8c8c75ab0 {NSLocalizedDescription=Simulator session timed out.}

iOS sim version 8.1 (550.3)
Update: I was able to solve my problem. It was a permission error. I'd created an ionic project using sudo and cause an issue with the files that the simulator was trying to execute (check last response at http://forum.ionicframework.com/t/simulator-session-timed-out-when-ran-ionic-emulate-ios/11437/4). Hope it helps

@dfang
Copy link

dfang commented Mar 17, 2015

ionic/cordova emulate ios gets nothing on the simulator, but this tips works !

thank you ......

@marcfalk
Copy link

Thanks, this worked like a charm :)

@yakupme
Copy link

yakupme commented Mar 22, 2015

Thank you very much indeed .! That works for me as well.

@omidahourai
Copy link

Worked, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment