我需要尝试绕过/忽略自签名证书的帮助..我到处都是,找不到到目前为止对我有用的任何东西..
I need help with trying to bypass/ignor a self signing certificate.. I have looked everywhere and cannot find anything that has worked for me thus far..
我正在尝试实施此处,但是我不确定如何使用此代码
I am trying to implements this here however im not sure how to use this code
@implementation NSURLRequest(AllowAllCerts) + (BOOL) allowsAnyHTTPSCertificateForHost:(NSString *) host { return YES; } @end我将其添加到我的应用程序委托中,但是然后我不知道该怎么办?
I add it to my app delegate but then I dont know what to do with it?
任何帮助将不胜感激..
any help would be greatly appreciated..
当前我什么也没用,因为没有任何效果对我有用.
currently I am not using anything because nothing has worked for me..
推荐答案这就是我的工作方式.我在调用连接的方法的下面添加了这两个方法.
This is how I got it to work. I added these two methods just below the method where I call my connection to start.
- (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]; }更多推荐
如何使用NSURLRequest忽略自签名证书
发布评论