Cordova + Crosswalk iOS 仍在使用 UIWebView [英] Cordova + Crosswalk iOS still using UIWebView

查看:39
本文介绍了Cordova + Crosswalk iOS 仍在使用 UIWebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有找到很多为 iOS 设置人行横道的说明,看起来应该很简单:

I didn't find a lot of instruction setting up crosswalk for iOS it seems like it should be as simple as:

cordova plugin add cordova-plugin-crosswalk-webview
cordova build ios

因为在我执行以下操作之前,我遇到了插件无法生效的问题:

Because I've had issues with plugins not taking effect before I do the following:

cordova plugin add cordova-plugin-crosswalk-webview
cordova platform remove ios
cordova platform add ios
cordova build ios

完成此操作后,当我捕获视图层次结构并检查它是否仍在使用其中有一个UIWebBrowserView"的UIWebView"(它位于滚动视图内部并且也有几个图像视图).

After having done this, when I capture the view hierarchy and inspecting that it's still using "UIWebView" which has a "UIWebBrowserView" inside of it (which is inside of a scroll view and there are a couple image views too).

另外,navigator.userAgent 如下:

Also, navigator.userAgent is as follows:

"Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13B143 (5618403776)" = $1

有人提到的另一个测试基本上是:

Another test someone mentioned was essentially:

if (window.indexedDB)
    console.log('Using crosswalk');
else
    console.log('Not using crosswalk/wkwebview');

而且 window.indexedDB 是未定义的.

And window.indexedDB is undefined.

那么...我需要做什么才能让应用使用 wkwebview?

So... what do I need to do so that the app uses wkwebview?

推荐答案

我是如何解决这个问题的

正如 JesseMonroy 如此乐于助人的回答(请随时为他投票)cordova 人行横道插件仅适用于 android.

由于 Apple 的服务条款,iOS 版的crosswalk 使用 wkwebview 代替,而非 ios 版的 chrome 会使用.

Because of apple's terms of service, crosswalk for iOS uses wkwebview instead of what non-ios version of chrome would use.

由于我知道没有适用于 crosswalk iOS 的 cordova 插件,我找到了适用于 WKWebView 的插件

Since there is no cordova plugin I know of for crosswalk iOS, I found plugins for WKWebView

我使用的插件是:https://github.com/Telerik-Verified-Plugins/WKWebView

这可能是更好的选择:https://github.com/apache/cordova-plugin-wkwebview-engine.. 但是我出错了.

This is probably a better option: https://github.com/apache/cordova-plugin-wkwebview-engine.. But it errored for me.

正如 Honry 所说:

As stated by Honry:

Crosswalk 将很快为 Crosswalk ios 提供一个 cordova 插件,请参阅票 https://crosswalk-project.org/jira/browse/XWALK-4911

Crosswalk will soon provide a cordova plugin for Crosswalk ios, see ticket https://crosswalk-project.org/jira/browse/XWALK-4911

XWalk 毕竟不会支持 iOS 插件,因为它没有提供任何优于 wkwebview 的必备优势

XWalk will not be supporting an iOS plugin afterall because it does not provide any must have advantages over wkwebview

这篇关于Cordova + Crosswalk iOS 仍在使用 UIWebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆