Ionic 2 cli command “ ionic emulate ios --liverelo

2019-08-01 03:51发布

问题:

So I am trying out Ionic 2. I found out this Ionic Cli command does not work:

ionic emulate ios --livereload

or

ionic emulate ios --lc

It show "Setup Live Reload" in the log but the app just hang in the opening splash screen. Can not find further error in the log (no error output), but the whole thing is frozen. It work without the -lc flag. So if I just run

ionic emulate ios

It works and the app launch. Anyone know a workaround for this? I am on iOs 9.3.

回答1:

I faced the same issue and these are the steps I followed:

  1. Open the root folder of the app.
  2. Find config.xml file.
  3. Look for the line <allow-navigation href="" />
  4. Change it to <allow-navigation href="http://YOUR_IP_ADDRESS:8100/" /> and save. Eg. <allow-navigation href="http://192.168.118.25:8100/" />
  5. Now run the ionic emulate ios -lcs command again.

This time it should work perfectly on your simulator.



回答2:

excute ionic address first
then excute ionic emulate ios --livereload
after some step, you have to choose a IP. Choose what ever you want and it will work!