如何用NSURLRequest忽略自签名证书

我需要帮助,试图绕过/忽略自签名证书..我到处都找,找不到任何迄今为止工作的东西..

我试图在这里实现这一点,但即时通讯不知道如何使用此代码

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

我把它添加到我的应用程序委托,但我不知道该怎么办呢?

任何帮助将不胜感激..

目前我没有使用任何东西,因为没有为我工作。

这是我得到它的工作。 我在这个方法的下面添加了这两个方法,在这个方法中我调用了我的连接。

 - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace { return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]; } - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; }