问题
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