iOS Emulator, LiveReload; App Hangs

When I try to run my app under the emulator with LiveReload, my app appears to hang. I don’t see errors in platforms/ios/cordova/console.log, and the emulator screen just remains white.

I’m on iOS 7.1 ( emulator ), Xcode V5.1, Cordova V3.5.0-0.2.7, and Ionic CLI 1.2.6-beta2.

iOS Safari on the emulator sends the following user-agent; [iOS Safari 7.0-7.1 has Web Sockets][http://caniuse.com/#feat=websockets]:

‘Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53’

I don’t see this hang when I don’t use LiveReload ( “ionic emulate ios” ); the app runs properly on the emulator.

Any ideas ?

bash$ ionic emulate ios -l -c -s

Setup Live Reload
Running dev server: http://192.168.2.1:8100
Running live reload server: http://192.168.2.1:35729
Watching : [ 'www/**/*', '!www/lib/**/*' ]
Ionic server commands, enter:
  restart or r to restart the client app from the root
  goto or g and a url to have the app navigate to the given url
  consolelogs or c to enable/disable console log output
  serverlogs or s to enable/disable server log output
  quit or q to shutdown the server and exit

r

Loading: /?restart=287806
add to body class: platform-ios
Running command: /Users/yea/myapp/platforms/ios/cordova/run --emulator
Build settings from command line:
    ARCHS = i386
    CONFIGURATION_BUILD_DIR = /Users/yea/myapp/platforms/ios/build/emulator
    SDKROOT = iphonesimulator7.1
    VALID_ARCHS = i386

[ ... ]

** BUILD SUCCEEDED **

2014-09-24 00:04:31.202 ios-sim[79230:507] stderrPath: /Users/yea/myapp/platforms/ios/cordova/console.log
2014-09-24 00:04:31.238 ios-sim[79230:507] stdoutPath: /Users/yea/myapp/platforms/ios/cordova/console.log
serve  /  (www/index.html)  iOS
serve  /lib/ionic/css/ionic.css  iOS
serve  /css/style.css  iOS

What version of ios-sim do you have? ios-sim is required by cordova for emulating from the command line

Hi! Have you found a solution for your issue? We are having a similar issue with ionic run instead of emulate. ionic run ios --device works, ionic run ios --device -l (with livereload) results in the ionic app hanging with splash screen on the iPhone. No error messages, nothing.

1 Like

Same issue. ionic emulate ios -l freezes ios9.1 emulator on the splash screen…

Same issue here… Loads fine without livereload but turning -l on it hangs at the splash-screen. Also tested with older apps that has worked fine in the past (no changes since they worked with livereload) and same issue happens here.

Any workarounds? Building the app to test through xcode for each change takes forever :confused:

hello, try

ionic emulate ios -l -c -s --address localhost

after update all (cordova, ionic etc) at latest version

1 Like

That solved it! :slight_smile: Thanks a lot for the quick response duepiudue!

1 Like

Just fount out that this is not working with Ionic 2 project.
ionic emulate ios -l -c -s --address localhost
App hangs on the default cordova splash screen.
Fresh project shows the blank white screen of death…

After latest updates it works fine. Witch leads us to the next question. How to avoid CORS issue in case of iOS emulator?

same here hangs on the splash screen!!!

This is the behavior we are still seeing on an Ionic 1 project. Even running the app from Xcode on the simulator yields the same results (and that doesn’t use -l). Running on the device from Xcode behaves the same way, until I rerun ionic emulate ios without the -l. Then both work.

One thing I’ve noticed is that when using ionic emulate ios -l, the following change is made to platforms/ios/config.xml:

<content src="index.html"/>
becomes
<content src="http://localhost:8100" original-src="index.html"/>

It’s only a temporary change, though. Now, for some reason, though, that page can’t be loaded on the simulator, and it definitely won’t work on the device. Does that help shed any light on this?