Can only launch one ionic 3 app at a time (webview bug filed)


#1

I have multiple similar apps(language difference). After installed on the same iphone, only one app can be launched at a time.The second app launched gives error “cannot connect to web server”. I’ve made sure that app identities on config.xml, package.json, etc are all unique. No issues with android. Any idea?

$ ionic info
:heavy_check_mark: Gathering environment info - done!

Ionic:

ionic (Ionic CLI) : 4.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 6.3.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 10 other plugins)

System:

ios-deploy : 1.9.2
ios-sim : 5.0.6
NodeJS : v8.11.1 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS Sierra
Xcode : Xcode 9.2 Build version 9C40b


#2

Suspect you’re sharing the provisioning profile???


#3

Thanks a lot for your help.
I use different profile actually.

This was the error I got from xcode debugging:

2018-12-01 19:43:08.803751+0100 myapp[1585:847792] Multi-tasking -> Device: YES, App: YES
[ERROR] Failed binding IPv4 listening socket: Address already in use (48)
2018-12-01 19:43:08.841943+0100 myapp[1585:847792] CDVWKWebViewEngine: trying to inject XHR polyfill
2018-12-01 19:43:09.938194+0100 myapp[1585:847792] CDVWKWebViewEngine will reload WKWebView if required on resume
2018-12-01 19:43:09.938250+0100 myapp[1585:847792] Using Ionic WKWebView

Why ip conflict? and why WKWEBVIEW?


#4

it’s a bug of the webview. I’m going to submit a bug.


#5

It’s already been raised.

It’s indeed an issue apparently with the web server of each app trying to take port 8080.

Sounds like they’re close to a fix - but for now you have two options:

Downgrade to a 1.x version of WebView, which did not use a webserver.
OR
Set the port number for each app to a different port

<preference name="WKPort" value="8081" />


#6

In response to my previous message - tried this and it works.

With a combination of

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

For your second app etc will keep the webservers seperate.


#7

thanks a lot.
that worked around the issue.
I read somewhere, webview 2.2.0 solved the issue of loading assets from other apps. so it introduced this new issue?
if user install my apps and ionic apps from other developers, there’s till chances, same conflict, correct?


#8

Whenever they started using a webserver to serve up files.

I don’t honestly know but worth keeping in mind.


#9

Worth to notice, according the last comment in the linked issue https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/165, the issue is solved, test are ongoing and if everything is fine will be soonish release :crossed_fingers:


#10

Just release my apps with the workaround in place. Many thanks again. You saved my day!


#11

Many thanks.That’s a good news. I was pretty frustrated when I discovered the issue and it took me quite some time to figure out what’s going on. Glad that It’s being resolved.


#12

Glad I was of help.

If you can mark as ‘solution’ on whichever was helpful and that’ll point future people towards the answer.

Thanks