How do I fix this error?!?! error starting local server:

Get help using Construct 2

Post » Wed Mar 29, 2017 9:51 pm

We built a successful ios app using adobe phone gap and construct 2 without issues. Then, all the sudden, after one update we continually get this error any time we open the IOS app on any device...

error starting local server: server is already up

Image

That error shows in a dialogue box and the app never runs thereafter.

What is causing this bug for IOS? We suspect it was when we enabled the ADMIN LOCAL SERVER option in construct2 to view on the local network, but have not been able to reverse it.

Our app does not require any server anything, it is a single player non-internet based app.
game works fine on everything but IOS now due to this error... ugh!

https://alphabetocean.boxels.com
B
11
S
7
G
1
Posts: 20
Reputation: 1,675

Post » Fri Mar 31, 2017 7:18 pm

I narrowed down this bug and found it is related entirely to enabling the LOCAL network server for testing on local network. This has hard coded an IPv4 address into the code somewhere, and this hard coded IPv4 address is what apple is crying about, as I have to hardcode an IPv6 as well if I have a IPv4 hard coded into the code.

I've disabled the local network, turned it off in preferences (back to LOCALHOST) but this still occurs now with every Cordova export... please help. what to do. where is it in the exported code to remove or change?!?
B
11
S
7
G
1
Posts: 20
Reputation: 1,675

Post » Fri Apr 14, 2017 6:08 pm

I can confirm this error, if I find a solution, I will update it here.

I couldn´t find any hardcoded ip adresses though, are you sure the preview is related to the error?
The error occurs in the c2runtime.js, I can´t really make much out of it though.

@Ashley :?

Code: Select all
if (this.isWKWebView)
      {
         if (this.httpServer)
         {
            this.httpServer["startServer"]({
               "port": 0,
               "localhost_only": true
            }, function (url)
            {
               self.httpServerUrl = url;
               self.fetchLocalFileViaCordovaAsText("data.js", function (str)
               {
                  self.loadProject(JSON.parse(str));
               }, function (err)
               {
                  alert("Error fetching data.js");
               });
            }, function (err)
            {
               alert("error starting local server: " + err);
            });
         }
         else
         {
            this.fetchLocalFileViaCordovaAsText("data.js", function (str)
            {
               self.loadProject(JSON.parse(str));
            }, function (err)
            {
               alert("Error fetching data.js");
            });
         }
         return;
      }


I can´t really test it right now but since this only is executed if this.isWKWebView is true, disabling WKWebView when exporting might do the trick. Maybe it´s an error with WKWebView rather than C2.
B
15
S
3
Posts: 62
Reputation: 989

Post » Tue Apr 18, 2017 3:42 pm

WackyToaster wrote:I can confirm this error, if I find a solution, I will update it here.

I couldn´t find any hardcoded ip adresses though, are you sure the preview is related to the error?

First off, Thank you for the reply, there is hope and we are not crazy as of yet!

We believe (remember we are noob programmers, which is why we use Construct2) it is preview server related due to our only seeing this IOS issue after enabling that option in preferences (whatever it adds to our build for cordova?) and apple insisting we add both iPV6 and iPV4 addresses to fix the bug...

apple's response from this sudden appearance of this new bug...
viewtopic.php?f=151&t=189857

We have reformatted our PC with a fresh windows 10 copy and a new Construct2 install (just to make sure it isn't related to settings in some rogue windows file from previous construct install) and the issue continues, suggesting that once the preference is enabled, it does something in the code (from our naive non-programmer perspective) no matter if we disable it afterwards and open the project on a fresh install of both Construct 2 and windows. It worked PERFECTLY BEFORE on IOS without issues.

I will be tackling this again today, and wanted to try side by side in beta Construct 3, but it says we can't upgrade our construct 3 subscription as of yet? so free edition doesn't help us there to test.

The last thing I'll test (a huge annoyance) is to redo the entire app in a new project, fresh install of Construct2 and Windows, without ever enabling that option to see if the error never pops up (due to never enabling preview server in preferences).

I will also see what we get with your suggestion but am brand new to this WKWebView thing... and trying to make sense (as a noob programmer) of these threads to see if they are related to what we are seeing:
issue-with-wkwebview-on-ios_t171504
and...
https://www.scirra.com/blog/ashley/25/h ... -wkwebview

All noob explanations welcome. Thanks in advance. Will return and report after trying with disabled WKWebView on cordova export
B
11
S
7
G
1
Posts: 20
Reputation: 1,675


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests