2016-08-22 4 views
2

私のドメインにはSSL証明書atmがないので、NSExceptionDomainsを使用してドメインをロードできるようにします。NSAppTransportSecurity(2ドメイン例外)

私はドメインの両方を許可するようにInfo.plistファイルに次のコードを使用して、それがアプリのいくつかの部分から提示されたので、私は2個のドメインでこの時間を渡すしたいサブドメイン

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

です別のドメイン。

私はちょうどこのような別のキーの追加を試みた:

<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> 

をしかし、それは動作しませんでした。それを行う正しい方法は何でしょうか?

答えて

1
<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> 

だけ

0

はこれを試してみてください、あなたの第二のドメインで最初のドメインとyourSecondDomain.comをごNSAppTransportSecurityの下でこの辞書をコピーして、あなたとyourFirstDomain.comを交換してください。これは、ドメインごとの例外の場合にのみ実行されるため、ドメインごとに例外が発生する可能性があります。そうしないと、完全に無効にATSは

みとめドメイン(洗面所独立Dictの者)

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

無効にATS完全

<key>NSAppTransportSecurity</key> 
<dict> 
    <!--Include to allow all connections (DANGER)--> 
    <key>NSAllowsArbitraryLoads</key> 
     <true/> 
</dict> 
(コードの第二セットを見て)ことができます
関連する問題