草庐IT

setAllowsAnyHTTPSCertificate

全部标签

objective-c - NSURLRequest setAllowsAnyHTTPSCertificate 到 Swift

下面的Objective-C代码的等效Swift代码是什么?[NSURLRequestsetAllowsAnyHTTPSCertificate:YESforHost:[urlhost]]; 最佳答案 解决方案:将此添加到文件info.plist中,这将强制ATS接受自签名证书:NSAppTransportSecurityNSExceptionDomainslocalhostNSIncludesSubdomainsNSExceptionAllowsInsecureHTTPLoadsNSExceptionMinimumTLSVersio