Live Reload Error: Failed to load webpage with error

Whenever I run the command “ionic emulate ios -l”, the command line will build and everything and when it opens in the simulator I get this error from the simulator console: “Failed to load webpage with error: The operation couldn’t be completed. No such file or directory”. I enabled App Transport Security in my info.plist and I have applied the iOS 9 patch as well.

System:

Cordova CLI: 5.3.1
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.0
Ionic Version: 1.1.0
Ionic CLI Version: 1.6.4
Ionic App Lib Version: 0.3.8
ios-deploy version: 1.7.0
ios-sim version: 4.1.1
OS: Mac OS X Yosemite (It is really El Capitan, but console says Yosemite).
Node Version: v0.12.7
Xcode version: Xcode 7.0 Build version 7A220

All help is vastly appreciated, thank you.

Yup, I’m having the same issue. I upgraded to El Capitan and Xcode 7. I’ve applied the transport security fix and updated to AngularJS 1.4.6 for the $location fix, and I still get launch failures with -l:

2015-09-21 15:51:42.041 OpenNMS[22763:308385] Failed to load webpage with error: The operation couldn’t be completed. No such file or directory

I am also having this exact error.

Same issue here. Did a bit of digging on Xcode but unfortunately I’m far from being the expert in objective C. It does look like a problem that occurs when Cordova is deciding which page to show. All goes well until Cordova tries to open the page (it does figure out the correct url from config.xml) and then for some reason it can’t open the live reload URL… maybe it messed it up. Or maybe there’s been an unexpected behaviour change in iOS/emulator.

Same here. ionic emulate -lc ios was working fine with Xcode 7 / iOS 9 with the App Transport Security workaround, but no longer works after upgrading to El Capitan.

The “Failed to load webpage with error” suggests it can’t connect to the local server for some reason.

I’ve modified CDVViewController.m to log which webpage it’s trying to load and it’s http://192.168.0.4:8100 - where 192.168.0.4 is the internal IP of my machine of course. curl -v 192.168.0.4:8100 shows the dev server is running fine.

I’ve then started the ionic serve --all, launched Safari in the iOS Simulator and pointed it to http://192.168.0.4:8100. Sure enough, it says “The operation couldn’t be completed. No such file or directory.” However if I open http://localhost:8100 or http://127.0.0.1:8100 it works fine.

It appears that the simulator can’t “see” to the local network but somehow maps localhost to the host machine.

But if it was started with localhost as the initial page it would work. Need to investigate what is passing that internal IP to start with…

1 Like

Ok, I’ve hacked Serve.getAddress() in ionic-app-lib to always return localhost and now livereload in the iOS Simulator is working again.

Raised https://github.com/driftyco/ionic-cli/issues/605

Definitely an issue with the iOS 9 simulator.

In the meantime, you can use an older version of iOS in the simulator. Not ideal, but it will at least let you emulate with livereload.

Have a look into this thread:

Especially those two answers were helpful to me: