YTKNetwork 适配HTTPS证书

YTKNetworkConfig *config = [YTKNetworkConfig sharedConfig];
    // /先导入证书
    NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"证书名称" ofType:@"cer"];//证书的路径
    NSData *certData = [NSData dataWithContentsOfFile:cerPath];
    config.securityPolicy.allowInvalidCertificates = YES;
    config.securityPolicy.validatesDomainName = NO;
    config.securityPolicy.pinnedCertificates = [NSSet setWithObject:certData];

你可能感兴趣的:(YTKNetwork 适配HTTPS证书)