gpt4 book ai didi

swift - 2 个域异常(exception)的 NSAppTransportSecurity

转载 作者:可可西里 更新时间:2023-11-01 01:32:19 25 4
gpt4 key购买 nike

因为我的域没有 SSL 证书 atm,所以我使用 NSExceptionDomains 来允许域加载。

我在 Info.plist 中使用以下代码来允许域及其子域

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>infever.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>

但是,这次我想通过 2 个域,因为应用程序的某些部分来自不同的域。

我试着像这样添加另一个键:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>infever.com</key>
<key>gentsgroup.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>

但这没有用。正确的做法是什么?

最佳答案

<dict>
<key>yourFirstDomain.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSRequiresCertificateTransparency</key>
<false/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<false/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
<key>yourSecondDomain.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSExceptionRequiresForwardSecrecy</key>
<true/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSRequiresCertificateTransparency</key>
<false/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<false/>
<key>NSThirdPartyExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<true/>
</dict>
</dict>

只需将此字典复制到您的 NSAppTransportSecurity 下,并将 yourFirstDomain.com 替换为您的第一个域,将 yourSecondDomain.com 替换为您的第二个域

关于swift - 2 个域异常(exception)的 NSAppTransportSecurity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39085557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com