Ajax https call in ios using PhoneGap not working?

拥有回忆 提交于 2020-02-11 01:47:31

问题


I could not able to do https POST call using ajax from ipad/iphone. Actually I am trying to call this in my PhoneGap application.

Could you please help me in this regard.


回答1:


You have not stated the kind of certificate on the server. I suspect that it is self signed. I have also had the same problem. Doing Ajax calls to a server with self signed certificated is NOT possible and this is a SDK limitation. You must write an Objective C plugin to go around this.




回答2:


Did you try to add this at the end of you AppDelegate.m file

@implementation NSURLRequest(DataController)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
    return YES; 
}
@end



回答3:


TDeBailleul,

Your code seems to work for an anonymous area of the web server, but doesn't work for myself in an Authorized area (cgi.auth_user) with Basic/NTLM authorization.

PhoneGap for iOS FAQ Q. Can I do AJAX with servers that have self-signed certificates? A. No, this is a iOS SDK limitation with UIWebview. You'll have to write an Objective-C plugin.

http://wiki.phonegap.com/w/page/41631150/PhoneGap%20for%20iOS%20FAQ



来源:https://stackoverflow.com/questions/9276643/ajax-https-call-in-ios-using-phonegap-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!