From 8f363c9c4b3aec580cc891d0805bc72bc5e610f0 Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Fri, 9 Oct 2015 15:44:33 +0200 Subject: [PATCH] #150 Conflict between apps --- README.md | 1 + plugin.xml | 2 +- src/ios/AppDelegate+WKWebViewPolyfill.m | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d892f10..7f0ff40 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ $ cordova prepare No need for anything else - you can now open the project in XCode 6 if you like. ## 4. Changelog +* __0.6.3__ By default the embedded webserver uses port `12344`, but if you want to you can now override that port by setting f.i. `` in `config.xml`. * __0.6.2__ LocalStorage is copied from UIWebView to WKWebView again (iOS location was recently changed as it appears). * __0.6.1__ Allow reading files from /tmp, so the camera plugin file URI's work. Thx #155. * __0.6.0__ iOS9 (GM) compatibility. Also, compatibility with iOS8 devices when building with XCode 7 (iOS9 SDK). Dialogs (alert, prompt, confirm) were broken. diff --git a/plugin.xml b/plugin.xml index 5e748a5..b6c49e0 100755 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ + version="0.6.3"> WKWebView Polyfill diff --git a/src/ios/AppDelegate+WKWebViewPolyfill.m b/src/ios/AppDelegate+WKWebViewPolyfill.m index 45cecec..cb29cbe 100755 --- a/src/ios/AppDelegate+WKWebViewPolyfill.m +++ b/src/ios/AppDelegate+WKWebViewPolyfill.m @@ -108,10 +108,15 @@ - (void)startServer [_webServerOptions setObject:[NSNumber numberWithBool:YES] forKey:GCDWebServerOption_BindToLocalhost]; - // Initialize Server listening port, initially trying 12344 for backwards compatibility + // If a fixed port is passed in, use that one, otherwise use 12344. + // If the port is taken though, look for a free port by adding 1 to the port until we find one. int httpPort = 12344; + + // note that the settings can be in any casing, but they are stored in lowercase + if ([self.viewController.settings objectForKey:@"wkwebviewpluginembeddedserverport"]) { + httpPort = [[self.viewController.settings objectForKey:@"wkwebviewpluginembeddedserverport"] intValue]; + } - // Start Server do { [_webServerOptions setObject:[NSNumber numberWithInteger:httpPort++] forKey:GCDWebServerOption_Port];