Search code examples
iosionic-frameworkcapacitor

Ionic Capacitor IOS Only Works With Livereload


In my ionic capacitor ios app, the app works just fine on a web browser using ionic serve. When I try running ionic capacitor run ios, that is successful but when I build the app I get this:

not working console

While that looks like a lot, you can see that at the end it says Webview failed to load and the request timed out. On my phone, all I see is the splash screen.

Instead, when I run ionic cap run ios -l --external, I get this:

working console with livereload

In this console, the same warning messages happen, but it says "onscript loading complete" and then the actual app works.

I have looked through many StackOverflow + github pages offering help for this issue. From this issue, I made sure that my phone and computer were on the same wifi. Anyone experienced this error before/knows what to do? This code has worked in the past.


Solution

  • I figured out the issue! The app was trying to connect to a server that did not exist. I needed to remove the server field in capacitor.config.json. I cut out that json field and then ran ionic cap run ios, and the code worked.

    Please comment if you are still experiencing this issue