7

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 cordova-ios@3.9.2
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
..
jedi
  • 839
  • 12
  • 33

2 Answers2

3

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');
}
jcesarmobile
  • 51,328
  • 11
  • 132
  • 176
  • There is something on your answer that is not correct or maybe i don't understand correctly. My application use IndexDB to store data and when i have tryed with iOS6, the application worked with IndexDB without WKWebView, so.. What the difference from iOS8? – jedi Oct 05 '15 at 15:33
  • No, you app can't be using IndexedDB, maybe WebSQL, IdexedDB was included on safari on iOS 8 and it's only available on the WKWebView, not on the UIWebView http://caniuse.com/#feat=indexeddb "Not supported in Chrome for iOS or other iOS WebViews." – jcesarmobile Oct 05 '15 at 16:50
  • Right! on the safari inspector console window.indexedDB return null. So.. On iOS my pouchadapter switch on WebSQL. The question is: how i can use WKWebView on iOS8? I have builded the app for target 8.0 [(img)](http://ginex.indivia.net/images/ios8_build.png) but window.indexedDB continue to return null. – jedi Oct 06 '15 at 09:16
  • 1
    If you installed crosswalk correctly, it should be using WKWebView. You can use the WKWebView using this plugin too https://www.npmjs.com/package/cordova-plugin-wkwebview – jcesarmobile Oct 06 '15 at 09:53
  • 1
    I have installed crosswalk with `cordova plugin add cordova-plugin-crosswalk-webview`. But for ios it's not enought. [Here](https://crosswalk-project.org/documentation/ios.html), i read that i have 3 method to use it: Extended WKWebView, Crosswalk Extension Framework, Cordova Plugins Support. But i don't understand what i must chose. I have tryed to compile crosswalk-ios and add it like library to the project but now xcode 6.4 fail to build it on linking with GCDWebServer. For me it's the first time with an cordova iOS app. I will try cordova-plugin-wkwebview. – jedi Oct 07 '15 at 08:24
  • Install the plugin I told you, it's easier than the crosswalk one – jcesarmobile Oct 07 '15 at 08:26
  • Tryed. I have now the IndexDB object. I have the ion background problem, that i can manage to solve and a lot of problem to load ionic js bundle. For example: `Error: undefined is not an object (evaluating 'a.nodeType') append@http://localhost:12344/vendor/ionic/js/ionic.bundle.min.js:200:331 http://localhost:12344/vendor/ionic/js/ionic.bundle.min.js:203:193 va@http://localhost:12344/vendor/ionic/js/ionic.bundle.min.js:45:296 $@http://localhost:12344/vendor/ionic/js/ionic.bundle.min.js:101:177 v@http://localhost:12344/vendor/ionic/js/ionic.bundle.min.js:90:204 ....` – jedi Oct 07 '15 at 08:43
  • sorry, no idea about that – jcesarmobile Oct 07 '15 at 08:47
  • 1
    the problem disappear if i close the safari web inspector. totally crazy! – jedi Oct 07 '15 at 09:19
1

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

Community
  • 1
  • 1
csga5000
  • 4,062
  • 4
  • 39
  • 52
  • Take a look to the update, if cordova crosswalk plugin only adds cross walk for android, the cordova platform output is trivial – jedi Nov 20 '15 at 17:22