从3.4更新后无法获取APPVIEW科尔多瓦5.1 [英] Can't get appView after Update to cordova 5.1 from 3.4
问题描述
我最近更新我的应用程序科尔多瓦5.1,我无法作出从JS Web请求。
I updated my app to cordova 5.1 recently and I am unable to make web request from JS.
在编译期间是唯一的问题
我班的onCreate功能扩展CordovaActivity里面
The only problem during compiling was inside onCreate function of my class that extends CordovaActivity
我以前做这个
super.appView.getSettings().setAppCacheEnabled(false)
现在它说,投它。我试过(的WebView)super.appView
,但应用程序崩溃为非法投
now it says cast it... I tried
(WebView)super.appView
but app crashed as its illegal cast
我看了此链接
并试图做同样的
(web视图)super.appView.getEngine()。getView()
但我仍然无法使Web请求....在iOS /桌面版Chrome正常工作所以没有什么是错误的JS code
I read This link and tried to do the same (WebView)super.appView.getEngine().getView() but I am still not able to make a web request.... on iOS/Desktop chrome it works fine so nothing is wrong in JS code
推荐答案
您必须得到的WebView
从科尔多瓦引擎。
You have to get the WebView
from the Cordova engine.
WebView webView = (WebView) appView.getEngine().getView();
这篇关于从3.4更新后无法获取APPVIEW科尔多瓦5.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!