Issues emulating ios


#26

@brentr Perhaps I should be a bit more clear. I have not found a way to make the warnings disappear or to make the emulator work flawlessly. However, if I open the emulator first (by opening xCode and then opening the emulator from the menu) and then run the ionic emulate command, it will still show the errors but the application loads in the emulator as expected without timing out. If I am inside of a tmux session, however, it times out regardless, thus my original comment regarding tmux.

No matter what, I still see the errors. It seems, as has been pointed out, that this is a Cordova problem and will hopefully be fixed soon. But, you should still be able to continue development by ignoring the errors and opening the emulator manually prior to running the ionic emulate command.

As an aside, for anyone who wishes to continue to use tmux, you can do so by following the instructions in the Tmux section of the ios-sim README: https://github.com/phonegap/ios-sim


#27

@jmcclellan Thanks for clearing that up and that makes sense.

So do you (or anyone else) know if those errors effect the build (rendered output)?


#28

You can use ios-sim start to start de simulator too(without opening xcode).


#29

@bentr - No, the errors don’t appear to be affecting the build or rendered output.


#30

This maybe something that the cordova people will have to take care of. The two warnings are from platforms/ios/cordova/emulate, where device type and family still use the old format. This just needs to be update.


#31

I am also having this issue. has anyone tried contacting cordova yet? when I try to launch the app from terminal it just goes to a black screen.


Ionic emulate ios FAILED
#32

I found that I was getting my black screen because of a java error after I fixed the error I still do get the same cordova error when I emulate to ios however my app is now launching.


#33

I have tried all the approaches suggested above, but unfortunately none of them worked for me. But I’m still glad and grateful for all these inputs, and feel that I’m not alone in this. >_<

Eventually I took an odd route, I went to click directly on /platforms/ios/cordova/emulate (in Finder), interestingly, that finally deploy and launch the app in my simulator. It still gives me the same warnings though, and I still build in command line, just couldn’t launch from it.

Hope a proper solution will be found soon!

Update: I no longer need to use the odd route I posted above after I upgraded my OS to Yosemite. I still get the warnings, but I could use the simulator more easily now.


#34

@team: Any update on this issue? Is there any ticket on cordova which has been raised?
Was very curious and desperate to try cordova + ionic + angularjs hands on and i’m badly stuck at this.

None of the above hacks working for me. Any more quick fixes / solutions to get rid of this issue?

Thanks,
noddycha


#35

Interestingly, the odd route is the only one that worked for me (I’m on Yosemite as well)


#36

Same here! I tried different version of everything (except for Xcode) and can only get it to work by going to the emulate file in Finder. Will update if I figure it out.


#37

had the same issue. Then realised I was running the commands from inside a tmux session. This seems to be the reason for cordova not being able to communicate with the iOS simulator. When I tried to run the command directly from a terminal, it worked just fine.


#38

@mhartington, thanks for your suggestion. it is works for me. First time when i run ionic emulate i got the above issue. Since now my simulator is already open, the next time when I run ionic emulate works for me.


#39

Awesome.
Note that the cordova cli has been updated recently so I’d suggest updating their CLI to the latest to make sure things are all good.


#40

I’ve tried everything in this thread and still no go. Thank you all for all the input and help thus far.

  • Uninstalled and reinstalled ios-sim, cordova, ionic. All latest versions.
  • ios-sim start works fine and my simulator is up and running when I try to run either ios emulate ios or cordova emulate ios and still nothing. Just times out and gives me the same error my emulator doesn’t change state (stays on home screen).
  • Tried directly running the emulate command under /platforms/ios/cordova/emulate and still nothing
  • not running tmux, just running it in straight terminal

Current versions:

  • ionic==1.2.8
  • cordova==3.5.0-0.2.6
  • ios-sim==3.0.0

Anyone come up with another solution? Can’t seem to figure this one out.


#41

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


#42

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.


#43

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!


#44

@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.


#45

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?