美文网首页
iOS nil host used in call to all

iOS nil host used in call to all

作者: Lee坚武 | 来源:发表于2021-03-15 17:20 被阅读0次

.h文件


//
//  NSURLRequest+DummyInterface.h
//  notification
//
//  Created by topwqp on 16/6/10.
//  Copyright (c) 2016年 topwqp. All rights reserved.
//

#import <Foundation/Foundation.h>
@interface NSURLRequest (IgnoreSSL)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host;
@end

.m文件



//
//  NSURLRequest+DummyInterface.m
//  notification
//
//  Created by topwqp on 16/6/10.
//  Copyright (c) 2016年 topwqp. All rights reserved.
//

#import "NSURLRequest+DummyInterface.h"
@implementation NSURLRequest (IgnoreSSL)

    + (BOOL)allowsAnyHTTPSCertificateForHost:(NSString*)host
    {
        // ignore certificate errors only for this domain
        if ([host hasSuffix:@"https://www.baidu.com"])
        {
            return YES;
        }
        else
        {
            return NO;
        }
    }
    
    @end

相关文章

网友评论

      本文标题:iOS nil host used in call to all

      本文链接:https://www.haomeiwen.com/subject/lgokcltx.html