bykof / cordova-plugin-webserver

A webserver plugin for cordova
Other
122 stars 49 forks source link

Conflicting with cordova-plugin-ionic-webview #12

Open kukukk opened 6 years ago

kukukk commented 6 years ago

Hi,

I wanted to try your plugin on iOS. A created a fresh new Ionic project and added your plugin. But when I try to build it I get an error. I tried from command line with "ionic cordova build ios" and also from Xcode but I got the following error: "197 duplicate symbols for architecture arm64".

After some more digging I found out that when I add the ios platform to ionic it automatically includes the cordova-plugin-ionic-webview plugin which also contains GCDWebServer. This is where the duplicate symbol error comes from.

Do you have an idea how to workaround this problem?

I'm using:

Update: If I remove cordova-plugin-ionic-webview it works. But, since it is include in Ionic by default, I'm not sure whether it is a good solution or not...

bykof commented 6 years ago

Holy... this sounds like a real problem. I couldn't imagine how to do a workaround... since its included by default, as you said it.

My project was build first with plain cordova, but it seems that a lot of people use ionic more than the plain cordova stack...

waidp521 commented 6 years ago

@kukukk I get the same problem. could you tell me how did you do to start a webserver? The js Embedded in my ionic app sends http request with http://localhost:8100. when I start a webserver with port 8100, it failed. when I start a webserver with 1111, it success,but doesnot perform "webserver.onRequest" . Could you help me ? Thank you.

kukukk commented 6 years ago

@waidp521: Since you are able to build your project you have a different problem.

samuelsont commented 6 years ago

Has this issue been fixed yet?? I also need to use this plugin with Ionic iOS webview... Could the GCDWebServer be removed for iOS to build without issues?

bykof commented 6 years ago

@samuelsont No it's not fixed yet. You could try to build it without the GCDWebserver...

samuelsont commented 6 years ago

I will try that. It should work.

However, I'm kinda lost on some important details. I guess the webserver starts in the same directory as the calling script. Is there a way to specify the www root folder? Also, how do I check and verify the webserver ip and port?

kukukk commented 6 years ago

Hi!

It seems that I will have to return to my project where I used this plugin. So, it is possible that I will make some more digging :}}

@samuelsont I don't think there is a www root folder. This server is not like Apache2 or Nginx or ExpressJS. It can't serve static folders. You have to handle the request inside the onRequest method and use the request parameter to get more informations like: request method, url endpoint, query parameters, headers, body. Based on those parameters you can implement serving content from a specific folder. The port is specified by you when you start the server. The IP will be you device's IP, if you are connected to a WiFi. If you are on mobile network the IP depends on you provider, whether they provide you a private or public IP (I doubt it will be public).

boedy commented 5 years ago

The lastest version of cordova-plugin-webserver uses CocoaPods as iOS package manager to pull in GCDWebServer. Can anyone confirm if the latest version resolves this issue?

Mapiac commented 5 years ago

Still lots of ppl using plain Cordova without Ionic (I might mention). ;)

caramorsimon commented 4 years ago

looks like this may have been fixed for IOS https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/244