iOS nil host used in call to all

2021-03-15  本文已影响0人  Lee坚武

.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
上一篇 下一篇

猜你喜欢

热点阅读