AIBugCim
AIBugCim

Reputation: 17

Ionic Cordova IOS Livereload Failed to load webpage with error: Could not connect to the server

So, I get the error "Failed to load webpage with error: Could not connect to the server" when I try to livereload my app on iOS. I have tried everything I can find on the topic. I've spent all day trying things. So I realized that maybe there is something needed that I don't understand. Here are the things I tried: "ionic cordova prepare iOS", "ionic cordova build iOS", "ionic cordova run ios --address=0.0.0.0 --debug --consolelogs -l", "

<allow-navigation href="http://localhost:8080/*" />
    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

", "cordova plugin rm cordova-plugin-ionic-webview cordova plugin add cordova-plugin-ionic-webview".

I thought maybe someone might have a different idea, or questions that will lead to the solution.

The app opens, and I get that message as an alert on my splash screen, but then it never moves past the splash screen.

Something I just thought of, if I use "ionic cordova run ios --address=0.0.0.0 --debug --consolelogs -l", do I need to use the ip address of my computer?

Any other suggestions or questions?

Upvotes: 1

Views: 1470

Answers (2)

Bashar Altakrouri
Bashar Altakrouri

Reputation: 10595

Make sure the testing iOS device is connected to WiFi.

Sometime this error may occur if the device you are trying to run the app on is not connected to the same WiFi network as the development machine you are using.

Upvotes: 1

CUGreen
CUGreen

Reputation: 3186

The docs will help you here.

Firstly, you will need to run the server. Do this by running

ionic serve

This should give you something like this at the end:

App running at:
- Local:   http://localhost:8100/ 
- Network: http://192.168.x.xxx:8100/

If you are wanting to run this on an actual iOS device on your network, then you will need to use your servers ip address. eg. 192.168.x.xxx.

Then you should be able to run the cordova livereload like this:

ionic cordova run ios --livereload-url=http://192.168.x.xxx:8100

Hopefully that works for you.

Upvotes: 2

Related Questions