.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
网友评论