使用 XMLHTTPRequest 发布到安全 Web 服务调用的 iOS Phonegap 应用程序返回状态为 0
我正在使用手机间隙开发 iOS 应用程序,但陷入了困境。 当我尝试使用 XMLHTTPRequest() 访问 Web 服务时,我得到的状态为 0。当我在 fiddler 中观看此请求时,我看到有正确的响应。
我已经查看了链接,说明 PhoneGap 应用程序不受同源策略的限制。但我还是没能解决这个问题。
我能看到的唯一区别是我访问的 url 是安全的 https。是否存在诸如 https 请求之类的不允许跨域的情况。
请帮忙。今天我被困在这里一整天了。
I am developing an iOS app using phone gap and am stuck at a point.
When I try to access a webservice using XMLHTTPRequest() I get an status as 0. When I watch this request in fiddler I see that there is proper response.
I have already looked at links stating the PhoneGap app are not restricted by same-origin policy. But I still fail to resolve this issue.
The only difference I could see was that the url I am accessing is secured https. Is there anything like requests to https are not allowed crossdomain.
Please help. I am stuck here for a whole day today.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
难道你指向的https webservice的证书是自签名的?
如果是这样,除了使用 PhoneGap ajax 调用的安全已知证书之外,没有其他办法可以使用任何东西。
请参阅:https 请求不'不能在phonegap-iphone应用程序中工作
另一个选项可能与您的XCode版本有关:在电话间隙运行 https 请求
Could it be that the certificate of the https webservice you are pointing to is self-signed?
If so, there is no way use anything but a secure known certificate with PhoneGap ajax calls.
See: https request doesn't work in phonegap-iphone app
Another option could be related to your version of XCode: run https request in phone gap