Ionic cordova run ios - ERROR: unable to load app


#1

Hello everybody.

After running ionic cordova run ios i see this error:

ERROR
Unable to load app

18

/Users/sagrus/new/platforms/ios/cordova/console.log is empty

Please help me


Can't run ios project in Xcode
#2

Getting this error as well using ionic cordova emulate ios, no idea why :confused:
Tried using the build.json from https://cordova.apache.org/docs/en/latest/guide/platforms/ios/, but it changes nothing.
Do I maybe need to additionally sign the app by configuring an Apple ID in Xcode and passing it via --codeSignIdentity and/or --developmentTeam?
The generated log at platforms/ios/cordova/console.log is completely empty.

Platform: iPhone-X, 11.4 (Xcode simulator)

Deploying to the browser as a PWA and emulating the hybrid app on Android is working just fine.

I’m using Ionic 4.3.1 and Xcode 9.4.1.
Just generated a fresh ionic 4 app using the sidemenu template, getting the error as well…


#3

In my case, the problem itself suddenly disappeared.


#4

Happy to hear that you don’t encounter the problem anymore. :slightly_smiling_face:
However, did you make any changes to your configuration, to your simulated device (did you use a different iOS version maybe?) or anything else?

Any changes you made to your ionic project, cordova or the xcode simulator might have “accidentally” resolved the problem, so I would be interested in hearing what you did, if you did anything…might be useful for people who stumble upon this problem in the future as well.


#5

no, I didn’t make any changes.


#6

I see, just have to wait and hope the problem disappears for me too I guess…thank you anyway though :slightly_smiling_face:


#7

Has anyone possibly found a solution for this problem yet? I really don’t know what else to try at this point… :pensive:
Otherwise, I guess my only option is to wait for capacitor replacing cordova in 2019 and hope for the best I guess? :no_mouth:

Well, creating a native iOS build with capacitor instead of cordova worked. Guess I’ll switch to capacitor as soon as possible :sweat_smile:


#8

same case to me…

I use ionic v3 to make 2 blank ionic app, and build to my iphone5 / iphone6plus and iphone8…
the 2 blank ionic app have difference app id ,…

when I kill all app , and open app1 , then app2 will show’s "ERROR Unable to load app "…and app1 is fine

but when I kill all app , and open app2 , then app1 will show’s "ERROR Unable to load app "…and app2 is fine

that means my phone only can open one ionic app???omg


#9

Solved for me, Also getting this same error, when i try to debug this thing on iOS
It start to server with default port no 8080(Check this thing in CDVWKWebViewEngine.m, method name startServer), so before run just check is any another server not using same port, if any another server use this port, then for ionic set it to different port no like i set it to 9191 and then run it.


#11

@ [hamentmiglani]
have any sample ??
Please


#12

this is becuase ionic made server for each app you run when you run app 1 it starts on port no 8080(default port set by ionic) and when run app 2, it start app on same port no then server of app1 get closed and it shows unable to load app. you have to run app1 and app2 on different ports.


#13

hamentmiglani
Thank’s so much


#14

It finally works using cordova as well! Thanks hamentmiglani for sharing your solution. :slightly_smiling_face:
I wasn’t getting the error while trying to run multiple apps, but only a single ionic app on the simulator.

I had to change the port from 8080 to 8181 not only in in the startServer() method, but every occurence of it in the xcode project. This includes the files:

  • CDVWKWebViewEngine.m
  • config.xml
  • GCDWebServer.m

Thanks everyone and good luck with your further development. :grin:


#15

My app got rejected due to this error. Can you share more details or code samples.


#16

After creating your iOS build, open the corresponding Xcode Project and replace every occurrence of “8080” with “8181” or another port. Use the magnifying glass in the upper left corner for that. That fixed it for me :wink:

Also, the order of users displayed for this thread made me laugh, have a look :laughing:

40


#17

Hi all , i find the best way to fix it now ^^
just on config.xml add the following :wink:

preference name=“WKPort” value=“8082”
allow-navigation href=“http://localhost:8082/*

It can change the port number,

I find that from GitLab:


#18

Thanks for the reply, that is indeed the best solution. :slight_smile:

I recommend including this config inside the <platform name="ios"> tag, or else you might get an error on the android version.


#19

Maybe i am missing something here, but how can we accept the port number change as a solution?? What happens if some other app built by another developer that runs via cordova with the same port number is installed on the same device?

What happens if 2 apps are running on the same port number no matter what that port number happens to be?

Just found out this issue is in discussion and a fix is a priority … see here:

cordova issue


#20

@disrupt You’re right, I just assumed this problem would only occur on the emulator, but according to this issue it seems to be a general problem, even using a production build on an actual device?

They even advice the port change in the Readme.md file: