Issues emulating ios

Running the emulate command under /platforms/ios/cordova/emulate worked for me as well on Yosemite.

What are the steps you took exactly? Because Iā€™ve tried this and I keep getting the timeout issue or permissions denied.

  • I navigate to /platforms/ios/cordova/emulate within the project folder, click on that

  • Opens up the terminal and simulator, I get a Permission denied, NSLocalizedFailureReason=An error was encountered while running error

  • run the command line with sudo (for permission issue) sudo {{ project path }}/platforms/ios/cordova/emulate, continue to get timeout issue Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 "Simulator session timed out.

  • Tried everything with both emulator already running and then without it open. Both same timeout issue.

Iā€™ll keep trying solutions and let yā€™all know if I come up with anything. Running Yosemite as well.

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
OR without change chmod
$ source ./emulate.sh

I hope this works for you. Enjoy!

1 Like

@eychu no go unfortunately. I still keep getting a timeout issue.:

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

I did find another solution though, which I actually like a lot since I can test directly on my iphone wirelessly and without having to pay for an apple dev account. Using the Phonegap dev app on my phone (http://app.phonegap.com/), I simply serve the app using phonegap CLI instead of ionic and connect to it with my phone:

$ phonegap serve

Then whatever address it gives me I plug into the the mobile app and it runs like a native app, with autoreload support out of the box. Itā€™s pretty cool.

I got the same error, definitely disconcerting when the ā€œgetting startedā€ blows up:

Session could not be started: Error Domain=DTiPhoneSimulatorErrorDomain Code=2 ā€œSimulator session timed out.ā€ UserInfo=0x7fc86a71a4d0 {NSLocalizedDescription=Simulator session timed out.}
Error: /Users/mloparco/dropbox/private/tech/ionic/myTabs/platforms/ios/cordova/run: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Ionic is awesome, but can we please get a flawless install going, or better support PhoneGap Build so we donā€™t have to deal with obscure CLI issues?

Double-clicking /platforms/ios/cordova/emulate seemed to work for me as well (still got Timeout error, but at least the myTabs demo was able to run).

Has anyone else noticed that the error is from ā€¦/platforms/ios/cordova/run ? It should be running cordova/emulate instead. If you run it from finder it loads the app in the simulator. What is making the decision to call ā€œrunā€ instead of ā€œemulateā€? I think that is the issue here.

I just used ā€œcordova emulate iosā€ inside the app folder. It is working perfectly. Still it would be nice if it was working via ā€œGetting Startedā€

I get the same error.

for me , ionic/cordova emulate ios get nothing on simulator, but this works !

thank you very much

Reset Content and Settings in the iOS Simulator fixed the problem for me.

I got the same error, and re install ios platform solved my issue. The commands I used in order:

sudo ionic platform rm ios
ionic platform add ios
ionic build ios
ionic emulate ios

Same here. And I believe the cause of the issue for me was that I previously used sudo to add ios.

This solution worked for me. Chmodded my app folder (recursive) to 777, then added and builded ios again. The iPhone 6 emulator boots up and everything works as expected.

thanks, that was my mistake.
donā€™t use the sudo, everything works now.

ios-sim --version 3.1.1
cordova -v 5.0.0
ionic -v 1.3.22
xcode 6.1.1