访问https 绕过证书验证方法

AFNetworking:

/* 关闭验证 */
    AFSecurityPolicy *security = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
    
    [security setValidatesDomainName:NO];
    
    security.allowInvalidCertificates = YES;
    
    manager.securityPolicy = security;

webview:

@implementation NSURLRequest (NSURLRequestWithIgnoreSSL)

+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
    return YES;
}

@end



你可能感兴趣的:(项目实用)