0

我正在使用parse.comlayer.com我的公司 url来获取条款/隐私政策,以及cocoapodsgoogle places api 等其他框架。

我被卡住了,因为我想使用正确的Apple Transport Settings,而且我似乎无法弄清楚如何在info.plist. 我不希望它在提交时被应用商店拒绝

我已经对堆栈溢出进行了研究,人们要么通过它,要么为一个域举了一个例子。目前还不清楚我应该如何在 xml 中添加它。

4

2 回答 2

1

如果您知道如何将一个域添加到例外字典中,那么您只需对所有其他域执行相同操作即可。这是一个例子:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>parse.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>                
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>layer.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
        <key>my-company.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
            <false/>
        </dict>
    </dict>
</dict>

NSAppTransportSecurity此外,可以在此处找到密钥的完整规范。

于 2016-02-05T23:59:17.950 回答
0

不要担心被拒绝的东西

根据这家伙的回答

好消息是 Apple 接受了我的应用,并将 NSAllowsArbitraryLoads 设置为 YES。

因此,在您的情况下,最简单的方法是以这种方式允许所有 http 请求,如果您的应用程序具有内置的网络浏览器,这绝对是您的选择

<key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
  </dict>

如果您只想允许特定的 http 请求,则可以将其添加到 info.plist

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>

上面的代码说允许yourserver.com及其子域 http 连接

于 2016-02-05T23:53:04.633 回答