代码之家  ›  专栏  ›  技术社区  ›  Hichame Yessou Xeoncross

ATS域异常上的通配符?

  •  1
  • Hichame Yessou Xeoncross  · 技术社区  · 8 年前

    可以在ATS异常字典上使用通配符吗?
    我试过类似的方法,但没有成功:

    <key>http://*.domain.com</key>
    <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key>
        <true/>
        <key>NSIncludesSubdomains</key>
        <true/>
    </dict>
    
    2 回复  |  直到 8 年前
        1
  •  5
  •   ColeX    7 年前

    试试这个:

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>domain.com</key>
            <dict>
                 <key>NSExceptionRequiresForwardSecrecy</key>
                 <false/>
                 <key>NSExceptionAllowsInsecureHTTPLoads</key>
                 <true/>
                 <key>NSIncludesSubdomains</key>
                 <true/>
            </dict>
        </dict>
    </dict>
    
        2
  •  1
  •   Sunny    8 年前

    虽然苹果高度建议使用HTTPS协议并对基于互联网的信息进行安全通信,但有时这并不总是可能的。例如,如果您正在与第三方web服务通信,或在应用程序中使用互联网交付的广告。

    信息。plist公司 文件将禁用ATS对给定域强制执行的安全默认值:

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>www.the-domain-name.com</key>
            <dict>
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.0</string>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>
        </dict>
    </dict>
    
    推荐文章