一、修改AFNetwoking源码
在AFSecurityPolicy 中修改evaluateServerTrust方法
二、在使用AFNetworking的时候添加代码
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
//忽略无效证书
AFSecurityPolicy *securityPolicy = [AFSecurityPolicy defaultPolicy];
securityPolicy.allowInvalidCertificates = YES;
manager.securityPolicy = securityPolicy;
网友评论