本文主要是介绍AFNetworking 使用https,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
AFNetworking https网络请求
验证证书
AFHTTPSessionManager *manager =[[AFHTTPSessionManager manager] initWithBaseURL:[NSURL URLWithString:APP_DATE_URL]];NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"https" ofType:@"cer"];NSData * certData =[NSData dataWithContentsOfFile:cerPath];NSSet * certSet = [[NSSet alloc] initWithObjects:certData, nil];AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate];//是否允许,NO-- 不允许无效的证书securityPolicy.allowInvalidCertificates = NO;
这篇关于AFNetworking 使用https的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!