iOS开发适配HTTPS详细教程

【HTTPS详细教程】
http://www.2cto.com/kf/201611/570823.html

AFN报错
在开发中是用AFNetworking https会报错-1012 报错如下·:
Error = Error Domain=NSURLErrorDomain Code=-1012 "The operation couldn’t be completed. (NSURLErrorDomain error -1012.)" UserInfo=0x7ff481e59d30 {NSErrorFailingURLKey=https://url, NSErrorFailingURLStringKey=https://url}
表示HTTPS 适配有问题

解决一 (AFSSLPinningModeNone型的)

// AFN  https适配
        
        AFSecurityPolicy *securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
        [securityPolicy setValidatesDomainName:YES];
       manger.securityPolicy = securityPolicy;
       manger.responseSerializer = [AFHTTPResponseSerializer serializer];


// AFSSLPinningModeNone:这个表示前端不用证书 其他的类型需要前端添加证书 

你可能感兴趣的:(iOS开发适配HTTPS详细教程)