Android debuggable = false导致Cordova/Phonegap Eclipse项目中的jQuery.ajax POST失败 [英] Android debuggable=false causing jQuery.ajax POST to fail in Cordova/Phonegap Eclipse project

查看:283
本文介绍了Android debuggable = false导致Cordova/Phonegap Eclipse项目中的jQuery.ajax POST失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Eclipse中构建的Android应用程序,该应用程序使用Cordova 2.0.0.当使用Eclipse调试器构建并加载到手机上时,该应用程序运行良好,但是当我在AndroidManifest文件中设置android:debuggable ="false"时,jQuery.ajax()POST失败.我什么都没告诉我LogCat跟踪中的失败原因.

I have an Android app built in Eclipse which uses Cordova 2.0.0. When built and loaded onto the phone using the Eclipse debugger the app works fine, but when I set android:debuggable="false" in the AndroidManifest file the jQuery.ajax() POST fails. I get nothing to tell me the failure reason in the LogCat trace.

这是jQuery.ajax调用:

Here's the jQuery.ajax call:

jQuery.ajax({
    url: that.endpoint,
    data: that.data,
    dataType: "json",
    type: "POST",
    contentType: "application/json",
    success: successHandler,
    error: errorHandler,
    timeout: serviceTimeout
});

当android:debuggable ="true"可以正常工作并转到成功处理程序,但是当android:debuggable ="false"时它将进入failureHandler,只有textStatus设置为"error",并且没有其他指示为什么失败了.当失败时,似乎该帖子没有发生,因为我可以看到它没有到达我尝试调用的Web服务.

When android:debuggable="true" it works fine and goes to the success handler, but when it android:debuggable="false" it goes to the failureHandler, with only textStatus set to "error" and nothing else to indicate why it failed. When it fails it appears that the post doesn't happen because I can see that it doesn't hit the webservice I am trying to call.

有人知道为什么可调试标志可能以这种方式影响我的应用程序吗?

Does anyone have any ideas why the debuggable flag might be affecting my application in this way?

可调试"标志会影响除日志记录级别之外的其他内容吗?

What else other than the logging level would the "debuggable" flag affect?

任何提示或指针将不胜感激.

Any hints or pointers would be greatly appreciated.

欢呼

推荐答案

找到了原因.我的代码很好.问题出在我尝试调用的Web服务的SSL证书上.尽管我的浏览器说还可以,但是当我使用SSL证书检查器进行检查时( http://www.geocerts.例如com/ssl_checker ),它表明证书层次结构存在问题.修复证书后,我的代码即可正常工作.

Found the reason for this. My code was fine. The problem was with the SSL certificate of the webservice I was trying to call. Although my browser said it was ok, when I checked it with an SSL certificate checker (http://www.geocerts.com/ssl_checker for example) it showed me there was an issue with a certificate hierarchy. Fixing the certificate allowed my code to work.

我的应用程序的iPhone版本从未遇到过此问题,因此Android似乎对SSL证书检查更为严格(并且在调试模式下运行时不进行证书检查.)

I never had this problem with the iPhone version of the app so it seems that Android is more strict with it's SSL certificate checking (and it does no certificate checking when running in debug mode.)

这篇关于Android debuggable = false导致Cordova/Phonegap Eclipse项目中的jQuery.ajax POST失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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