【问题标题】:What is NSExceptionDomains and when should I use it?什么是 NSExceptionDomains,我应该什么时候使用它?
【发布时间】:2017-03-21 13:44:56
【问题描述】:

iOS 网络编程新手。

请任何人帮助理解这一点?

  <key>NSExceptionDomains</key>
    <dict>
        <key><!-- your_remote_server.com / localhost --></key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSExceptionRequiresForwardSecrecy</key>
            <true/>
        </dict>
    <!-- add more domain here -->
    </dict>

【问题讨论】:

  • 这两个设置似乎有点矛盾:允许未加密的 HTTP,但也需要对 HTTPS 进行更强的加密。
  • @rmaddy 你还可以提交到 App Store 并启用 NSExceptionDomains 吗?

标签: ios app-transport-security


【解决方案1】:

Apple 引入了应用传输安全 (ATS),并要求应用具有安全连接以进行服务器通信。作为一项临时措施,在所有应用程序和服务器都符合要求之前,它们允许您定义安全要求的例外情况。你可以在这里阅读更多:https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35

【讨论】:

  • 这也意味着:如果您可以正确地修复传输安全性,您应该不使用它。
  • 没错,您应该暂时考虑异常并尽快删除异常
猜你喜欢
  • 2011-01-18
  • 2011-08-18
  • 2010-09-05
  • 2012-08-23
相关资源
最近更新 更多