Cordova 3.0,应用程序错误与服务器的连接失败. (暂停) [英] Cordova 3.0, Application Error The Connection to the server was unsuccessful. (Timeout)

查看:205
本文介绍了Cordova 3.0,应用程序错误与服务器的连接失败. (暂停)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于尝试加载本地index.html文件而导致出现此超时,但是我无法弄清楚如何将超时时间从默认的20秒增加.我看到过有人在droidgap扩展名onCreate方法中使用以下行的帖子:

I've am getting this timeout from trying to load my local index.html file and I cannot figure out how to increase the timeout time from the default 20 seconds. I have seen posts where people use the following lines in their droidgap extension, onCreate method:

super.setIntegerProperty("loadUrlTimeoutValue",70000); super.loadUrl("file:///android_asset/www/index.html");

super.setIntegerProperty("loadUrlTimeoutValue", 70000); super.loadUrl("file:///android_asset/www/index.html");

但是即使这样做,该应用程序仍会在20秒后超时.该index.html文件的加载时间超过20秒,因为它正在使用window.open(inAppBrowser)调用来获取远程资源.

But even doing so, the app still times out after just 20 seconds. It takes longer than 20 seconds for that index.html file to load because it is using a window.open (inAppBrowser) call to fetch a remote resource.

在Cordova 3.0中是否设置了超时设置的新地方?我正在从phonegap 2.3迁移,该问题并未发生.

Is there a new place where the timeout is set in cordova 3.0? I'm migrating from phonegap 2.3, where this issue didn't happen.

推荐答案

检查此链接.

对我来说,在应用程序启动时,我们不得不做很多ajax的事情.然后,这经常(非常有规律,但不是每一次 )似乎会干扰向Android(Cordova?)发出的低级应用已启动并正在运行"的信号.然后,大约20秒后,该应用就会被上述错误杀死. 因此,使用几乎为空的index.html进行启动,然后将其重定向到真实页面-似乎愚弄了所有参与方,使他们认为该应用程序已完全启动并可以即时运行.

For me it was a case where we had to do a lot of ajax stuff when the app started up. Often (very regularly, but not every time) this would then seem to interfere with the low level "app is launched and running" signal to Android (Cordova?). And then the app get's killed with the above error after about 20 seconds. So launching with an almost empty index.html and then getting that to re-direct to the real page - that seems to fool all the parties involved into believing the app is fully up and running in no-time flat.

这篇关于Cordova 3.0,应用程序错误与服务器的连接失败. (暂停)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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