Has anyone truly started from scratch lately?

I’ve searched high and low trying to get ionic to work on iOS simulator. It seems everyone that shows you how (including the official deep dive video) makes some assumptions of what’s already on your Mac and/or are very outdated.

From what I’ve gathered this is what you are supposed to do (and I’ve tried numerous times):

  1. Start with a brand new El Capitan install with all the latest updates.
  2. Install Xcode.
  3. Load Xcode command line tools.
  4. Start Xcode to accept the license agreement and install additional tools it says are required.
  5. Install Node LTS (ionic docs say Node 5 does not work yet).
  6. sudo npm install -g cordova ionic gulp
  7. sudo npm install -g ios-sim
  8. sudo npm install -g --unsafe-perm=true ios-deploy (told to add that unsafe flag when installing without it)
  9. ionic start myApp tabs
  10. cd myApp
  11. ionic platform add ios
  12. ionic build ios
  13. ionic emulate ios

The emulator chokes immediately with:

No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state

This link says its supposedly due to: “don’t use sudo on the ionic commands” but as you can see I did not.

a. Empty the ‘platforms’ folder in your Ionic project
b. Re-run ionic platform add ios, ionic build ios, and ionic emulate ios without sudo (which I did in the first place)
c. Reset the permissions (not sure why this would be an issue its a fresh OS install) but I’ve tried with and without to no avail.

Then I build and run again:

ionic build ios
ionic emulate ios

This time I’m greeted by this (and it returns me to the command prompt):

No target specified for emulator. Deploying to iPhone-6s-Plus, 9.2 simulator
logPath: /Users//myApp/platforms/ios/cordova/console.log

The simulator is stuck at the “desktop icons”, the app is never presented, and that log file doesn’t exist.

I kill the simulator and build and emulate again and this time it works.
I kill the simulator and build and emulate again and the app starts but the tabs have no icons.
I kill the simulator and build and emulate again and the app starts but the tab buttons do not respond to taps.

And so it goes. I’ve researched each item I’ve run into and tried to resolve them with no luck.

Does not seem to work consistently at all.

It shouldn’t be this hard. Does anyone know how to make the set up above work out of the box consistently?

Seems to me the best people to address this are the ionic devs or you’re loosing users right out of the gate.

Just set up a new Mac not too long ago and ran into no issues. My gut says something is wonky with Xcode and the sim. What happens if you open the platform directory and open the actual Xcode project within the iOS directory and try running it?

Basically the exact same results.

Hi there! So sorry that you’re having trouble!

I’m a bit lost as to what could be going on. Having setup many machines before, there’s nothing really standing out that could be causing issues.

A random idea is that something didn’t install correctly? Maybe check the xcode installation, any of the simulators, etc.

I’ve totally fried my mac several times (reloading a fresh El Capitan per Apple restore instructions) and I always get the same thing.

If you have an available machine try the exact steps I’ve listed. The resulting ionic install is hosed every time for me.

Hmmm, I can test that out tonight (going to take a bit clear my old macbook out)
But I will get back to you. I’ll put together a video as well.

Hi jwleigh, I had started a new project around 2 weeks ago, was working great but today it spectacularly failed. Having a real hard time with everything. Finally have it to step 13 as you’ve listed. But yes I also get:

** BUILD SUCCEEDED **

No target specified for emulator. Deploying to iPhone-6s-Plus, 9.2 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state

Installing ionic@beta as sudo allows me to build, but then unable to open xcode project as owned by root/wheel

@jwleigh I found the following very helpful and resolved my emulation issue: http://zacvineyard.com/blog/2015/11/ionic-invalid-device-state-error-with-xcode-7-solved

Also, I did the following prior: Cordova CLI: 6.0.0 - Not detected, please help!

Your first link is the same link that I posted that did not solve my issue. After looking at the other link it appears the only difference from what I’m doing is that you uninstalled the platforms and node and then reinstalled node using brew.

I’ll certainly try that but I also look forward to mhartington’s test outcome too.

It’s a mess. I am developing an app and I am at the final stages, but suddenly, it does not work. Well, sometimes it does work. But these things happen randomly:

  • 80% of the times I get this “(domain=com.apple.CoreSimulator.SimError, code=159)” error

In combination with:

  • The app hangs while showing the splash screen
  • The app gets past the splash screen but shows a white screen instead
  • The app works

The error mentioned above is shown in combination with each of the three states. This drives me nuts!

I’ve done pretty much everything: Re-installed npm, ionic, … I even did a fresh install of Xcode. I created an entire new project and copied all JS/HTML files manually and gradually added the cordova plugins.

What is going on? :frowning:

Yup, same thing for me still. I gave up. Never heard back from @mhartington on his rebuild try.

Have better things to spend my time on until we get some type of official resolution…

Hi there!

So after being a little distracted…(for a few weeks)

I finally put a small video together for my process.

Thanks Mike, I’ll try this exactly as you have when I get a chance. The big difference I see from my process is I used the node installer, not homebrew. Like you said that shouldn’t matter but I certainly did not get the smooth final output that you did.

Three questions:

  • What exact rev of Mac OS are you on.
  • What are your macbook specs? The simulator, etc.,… launch much slower on mine than your video (assuming that was real time video)
  • Did you install Xcode from Apple Store or from download links after logging into developer.apple.com
  1. Fresh install of OSX El Capitan
  2. It’s non-retina mac book pro. The video was cut to shorten the length of the install times. Raw install from npm was about 3-4mins for cordova/ionic.
  3. I installed xcode from the app store. But the install link shouldn’t matter.

ok, thanks, those are all the same as mine

I’ll see if I can try this again tonight following your exact video

Check out this thread maybe:

I could solve my problems - at least I hope I did. LiveReload does not work though.