Cordova WKWebView Plugin with PhoneGap Build Version 6.0.0 - phonegap-build

From the blog post about PhoneGap 6.0.0 being available on Build my understanding is that we can now use the Cordova WKWebView engine with apps build with PhoneGap Build. See:
http://phonegap.com/blog/2016/02/09/phonegap_6_now_on_build/
https://shazronatadobe.wordpress.com/2015/09/09/apache-cordova-ios-4-0-0-and-wkwebview-support/
https://github.com/apache/cordova-plugin-wkwebview-engine
I've updated my config version to include the following but am still getting the default UIWebView:
<preference name="phonegap-version" value="cli-6.0.0" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Has anyone been able to get this working that could help?

Thanks to this post I found part of my solution http://community.phonegap.com/nitobi/topics/does-phonegap-build-support-wkwebview-with-the-new-cli-6-0 - I was missing the following line in my config.xml:
<plugin name="cordova-plugin-wkwebview-engine"/>
However, I also found that I needed to turn off Hydration to get the app past the "initialising" screen.

Related

Upgrading to Cordova ios6 causes errors in xcode for project

I am able to successfully build and run my app in ios5, but when I upgrade to ios6.1.0 in order to install a plugin that will allow me to use VKwebview and reference local html files, I get 3 fatal errors in xcode:
Property 'userAgent' not found on object of type 'CDVViewController *'
Use of undeclared identifier 'CDVUserAgentUtil'. (these are repeated twice)
I am at a total loss as to even start looking for the answers.
This is my config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.slate.v2" version="1.3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>ACCELERATE RMS</name>
<description>
M-learning accelerated.
</description>
<author email="support#phonegap.com" href="http://phonegap.com">
Cnnect
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="*" />
<icon density="mdpi" height="57" platform="ios" src="icon.png" width="57" />
<config-file overwrite="true" parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
<string>Allow the app to use your camera to take your profile picture.</string>
</config-file>
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<platform name="ios">
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>
<platform name="ios">
<preference name="Orientation" value="all" />
</platform>
<engine name="browser" spec="^5.0.4" />
<plugin name="phonegap-plugin-contentsync" spec="~1.4.2" />
<plugin name="cordova-plugin-camera" spec="~4.0.3" />
<plugin name="cordova-plugin-geolocation" spec="~4.0.1" />
<plugin name="cordova-plugin-file" spec="~6.0.1" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.3" />
<plugin name="cordova-plugin-dialogs" spec="~2.0.1" />
<plugin name="cordova-plugin-local-notification" spec="~0.9.0-beta.3">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="26.+" />
</plugin>
<plugin name="phonegap-plugin-barcodescanner" spec="~8.0.1" />
<plugin name="onesignal-cordova-plugin" spec="~2.8.1" />
<plugin name="cordova-plugin-file-transfer" spec="~1.7.1" />
<plugin name="cordova-plugin-wkwebview-engine" spec="^1.2.1" />
<plugin name="cordova-plugin-wkwebviewxhrfix" spec="~0.1.0" />
</widget>
CDVUserAgentUtil has been removed in cordova-ios#6 which is a breaking change (hence the major version increment in cordova-ios to 6).
This class is used by some Cordova plugins in your project hence the error.
You should first update all of your plugins to the latest versions so those which have been updated to removed references to CDVUserAgentUtil are used.
At least one of your plugins - cordova-plugin-file-transfer is deprecated and contains an implicit reference to CDVUserAgentUtil. In this case you could use my fork of this plugin which has been fixed to remove the reference:
cordova plugin rm cordova-plugin-file-transfer && cordova plugin add https://github.com/dpa99c/cordova-plugin-file-transfer
It may be that other plugins in your project still contain references to CDVUserAgentUtil after updating all your plugins.
If this is the case, you should search them for references:
grep -r -l 'CDVUserAgentUtil' plugins/
If you find any references and no plugin upates are available, you could:
raise an issue against the plugin asking for it to be updated
look for a fork of the plugin that has already been updated
fork the plugin and fix it yourself
If the build still fails after updating all your plugins to remove the references, there may be more implicit references such as that in cordova-plugin-file-transfer so you'll need to search for and resolve those:
grep -r -l 'userAgent' plugins/
The cordova-plugin-wkwebview-engine is deprecated in Cordova iOS#6.x for more details see, from Cordova iOS#6.x onwards it by defaults supports WKWebView not UIWebView. So, you need to remove the Cordova plugin from your project.
cordova plugin rm cordova-plugin-wkwebview-engine
Note : Please backup your project before doing any change for your safety.
For ionic v5 users
I have fixed this by upgrading cordova-plugin-ionic-webview to 4.2.1
hopping this help

Cordova InAppBrowser plugin broken for OSX platform

When compiling a cordova macos app with the InAppBrowser plugin installed under Mojave 10.14.2 and Xcode 10.1 I get the following error message:
ERROR: Plugin 'InAppBrowser' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml
I've checked the config.xml, and it contains the correct entry:
<plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
I've looked in /plugins and the plugin and its xml file are there.
I've removed and added the plugin and the platform.
Taking a cue from this old (and marked fixed) bug, I manually inserted the following into the config.xml file in Xcode:
<feature name="InAppBrowser">
<param name="osx-package" value="CDVDevice" />
</feature>
That changes the error message to this:
ERROR: Method 'open:' not defined in Plugin 'InAppBrowser'
Any ideas what's going on here?
<platform name="osx">
...
<feature name="InAppBrowser">
<param name="osx-package" value="CDVInAppBrowser" />
</feature>
...
</platform>
This works for me.

phonegap build for kitkat

I have made a phonegap app which works on all other devices except my tablet which runs KitKat(the app installs but displays a blank white screen instead of the content). I checked to see if this was an issue with it being a tablet but it seems to be the android version as the exact same app build works on another tablet running android lollipop...
This is the code in my config file, is there something else I need to add or something I should remove so that it will run correctly on the KitKat tablet?
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.helloworld"
version="1.0.0"
xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
xmlns:android = "http://schemas.android.com/apk/res/android">
<config-file platform="android" parent="/manifest" mode="merge">
<supports-screens
android:xlargeScreens="true"
android:largeScreens="true"
android:smallScreens="true"
android:requiresSmallestWidthDp="600"
/>
<uses-sdk android:minSdkVersion="19"
android:targetSdkVersion="19"/>
</config-file>
<name>My App</name>
<description>
Tablet App.
</description>
<content src="index.html"/>
<preference name="target-device" value="universal" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="19"/>
<preference name="orientation" value="landscape" />
<access origin="*"/>
</widget>
I am not using an plugins, and am using build.phonegap to build my app.
Thanks in advance
I managed to get the google chrome remote device debugger working and it was an error in my code: I had used let instead of var and KitKat does not recognize let.
I changed all my let declarations to var and now it works perfectly.

libMobileGestalt MobileGestaltSupport.m:153: pid 1668 does not have sandbox access in Xcode console

I'm seeing this message in the Xcode console whenever I run the app:
libMobileGestalt MobileGestaltSupport.m:153: pid 1668 (APP_NAME) does not have sandbox access for frZQaejlsahdhlemg and IS NOT appropriately entitled
Using Apache Cordova, in my case, I had the same issue, and after some deep searches, I found it was originally (and stupidly) due to Splashscreen.
Check/add these lines in your config.xml file :
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="true" />
<feature name="SplashScreen">
<param name="ios-package" onload="true" value="CDVSplashScreen" />
</feature>
And then my app worked like a charm.
Hope this helps in your case.
After digging into it, I found that embedding a UIViewController -or any subclass of it- in a navigation controller is the main reason to show this error message.
I'm not sure what exactly makes the navigation controller show this message.
Edit 1:
After Xcode 9, I'm not seeing this issue anymore with new projects created in Xcode 9
Edit 2:
In Xcode 9, I saw the same error when working with CGRect.

why does cordova app hang on launch in xcode with cpu 100%?

cordova version 5.0.0
xcode version 7.3
i have a cordova app (with ember.js) that, when launched, hangs on launch in xcode. this does not happen every time, it is intermittent. when it does happen, the cpu in cordova hovers around 100%. the app is non responsive; taps on buttons do nothing.
below is the system log, and listed here are the plugins being used. how can i begin to debug this? i can't connect to the app with safari debugger; the app is listed in the develop menu but the debugger is blank.
plugins:
<plugin name="cordova-plugin-crosswalk-webview" spec="1.5.0" />
<plugin name="cordova-plugin-device" spec="1.1.1" />
<plugin name="cordova-plugin-statusbar" spec="2.1.0" />
<plugin name="cordova-plugin-network-information" spec="1.2.0" />
<plugin name="cordova-plugin-inappbrowser" spec="1.2.0" />
<plugin name="cordova-plugin-appsee" spec="2.1.55" />
<plugin name="ionic-plugin-keyboard" spec="1.0.8" />
<plugin name="sk.kcorp.cordova.ios-security" spec="https://github.com/robertklein/cordova-ios-security.git" />
<plugin name="cordova-plugin-whitelist" spec="https://github.com/sovolve/cordova-plugin-whitelist.git" />
<plugin name="cordova-plugin-contacts" spec="2.0.1" />
<preference name="android-windowSoftInputMode" value="adjustPan" />
<preference name="android-configChanges" value="orientation|keyboardHidden" />
<plugin name="cordova-plugin-facebook4" spec="~1.4.1">
<variable name="APP_ID" value="1650330931884748" />
<variable name="APP_NAME" value="Wonder" />
</plugin>
<plugin name="onesignal-cordova-plugin" spec="~1.11.2" />
last chunk of system log (there's a lot more, too much to fit here)
http://pastebin.com/7HzgP4eB
Which version of cordova-ios are you running? Version 4.0.0 of cordova-ios had a bug which caused 100% CPU usage on launch (see https://issues.apache.org/jira/browse/CB-10276 for more information). This has been fixed since 4.1.0. You can check by running this command:
cordova platform version
To update to the latest version, run:
cordova platform update ios

Resources