Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova-plugin-crosswalk-webview on iOS

I have created a cordova project adding 2 platforms (android, ios) with some plugin. One of them is the last cordova-plugin-crosswalk-webview (1.3.1). I have chose iOS8 and android 4.0 like target android. Everything work well, i can build the android platform and the iOS too.

On my config.xml file this line are automatical added:

...
<preference name="xwalkVersion" value="14+" />
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="embedded" />
...

For android i'm sure to use the crosswalk plugin. With Chrome inspector i can see the navigator.userAgent setted to Crosswalk similar to this image

My package android-debug.apk is now splitted in android-debug-armv7.apk and android-debug-x86.apk and the apk size is near to 25Mb.

But for iOS i can't undestand if crosswalk is working or not. On the safari inspector of my iOS Virtual Machine the navigator.userAgent variable is:

"Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X)  AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H141 (140222960683616)"

How i can be sure of what browser i'm runnig on my iOS? And, if the config.xml configuration is not enought, how i can set crosswalk-webview fos iOS?

I have read the quick start guide of crosswalk for iOS but i think that is not so understandable for who use cordova CLI normally. And nothing is written on documentation of cordova-plugin-crosswalk-webview npm package.

UPDATE:

Follow the cordova output:

$ cordova plugin list
cordova-plugin-crosswalk-webview 1.3.1 "Crosswalk WebView Engine"


$ cordova platforms add ios

Adding ios project...
iOS project created with [email protected]
Running command: /Users/jedi/prj/appMobile/hooks/after_prepare/010_add_platform_class.js /Users/jedi/prj/appMobile
add to body class: platform-ios
Running command: /Users/jedi/prj/appMobile/hooks/after_prepare/030_resource_files.js /Users/jedi/prj/appMobile 
...
Installing "cordova-plugin-console" for ios
Installing "cordova-plugin-crosswalk-webview" for ios
Installing "cordova-plugin-device" for ios
..
like image 508
jedi Avatar asked Oct 02 '15 17:10

jedi


Video Answer


2 Answers

crosswalk on iOS uses the native WKWebView, that has indexedDB support, you can run this javascript code to check if it's the WKWebView

if (window.indexedDB) {
    alert('WKWebView');
} else {
   alert('UIWebView');
}
like image 88
jcesarmobile Avatar answered Oct 18 '22 03:10

jcesarmobile


The cordova crosswalk plugin only adds cross walk for android.

Note that crosswalk for iOS is required to use webkit for apps on the app store, so it essentially uses WKWebView. (It uses webkit instead of the usual blink engine chrome is based on)

See Jesse's response to my question: Cordova + Crosswalk iOS still using UIWebView

like image 21
csga5000 Avatar answered Oct 18 '22 04:10

csga5000