Wcf 在iOS中验证SSL证书

Wcf 在iOS中验证SSL证书,wcf,cocoa-touch,web-services,ios5,Wcf,Cocoa Touch,Web Services,Ios5,我创建了一个使用https托管的WCF web服务,我需要使用iPhone应用程序访问此服务。 该服务运行良好,我可以使用浏览器检索数据。在这种情况下,我需要预先批准证书(“此服务器的证书无效”) 但在iPhone应用程序中,我无法使其工作。 到目前为止,我所做的是: - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticatio

我创建了一个使用https托管的WCF web服务,我需要使用iPhone应用程序访问此服务。
该服务运行良好,我可以使用浏览器检索数据。在这种情况下,我需要预先批准证书(“此服务器的证书无效”)
但在iPhone应用程序中,我无法使其工作。
到目前为止,我所做的是:

     - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{
[[challenge sender]continueWithoutCredentialForAuthenticationChallenge:challenge];
}

连接返回时出错(与浏览器所说的完全一致)
请求应该返回一个字符串或一些非常简单的内容

在这一点上我该如何进行?顺便说一句,我使用iOS5.0
感谢您找到了它,只需在连接willSendRequestForAuthenticationChallenge方法中再添加一行即可

[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];