2016-02-05 23 views
0

我使用parse.comlayer.com,並我公司網址的條款/隱私政策,以及其他框架中cocoapods像谷歌Places API的。的iOS應用9運輸安全爲多個服務

我被卡住了,因爲我想使用正確的Apple Transport Settings,我似乎無法弄清楚如何在info.plist中包含所需的所有東西。 我不希望它在提交時被應用商店拒絕。

我已經做了關於堆棧溢出和人的研究,或者通過它或者給出了一個域的例子。它仍然不清楚我應該如何在XML中添加這個。

+0

更好地找到解析的替代方案... – LinusGeffarth

+0

有很多設置ATS的例子。分別解決每個域的問題。請記住,您只需向ATS添加一個不是最新的域即可。 – rmaddy

+0

Linus G.是的,我知道,將有更多工具可用時進行遷移。和@rmaddy你是什麼意思「對於一個不是最新的域名」 – kareem

回答

0

不要擔心根據this guys answer

好消息是蘋果接受我的NSAllowsArbitraryLoads應用程序中設置 爲是拒絕的事情

所以你的情況最簡單的方法是允許這樣所有的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連接

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鍵全規格可以發現here