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):
- Start with a brand new El Capitan install with all the latest updates.
- Install Xcode.
- Load Xcode command line tools.
- Start Xcode to accept the license agreement and install additional tools it says are required.
- Install Node LTS (ionic docs say Node 5 does not work yet).
- sudo npm install -g cordova ionic gulp
- sudo npm install -g ios-sim
- sudo npm install -g --unsafe-perm=true ios-deploy (told to add that unsafe flag when installing without it)
- ionic start myApp tabs
- cd myApp
- ionic platform add ios
- ionic build ios
- 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
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.