2016-08-22 5 views
2

내 도메인에 SSL 인증서 atm이 없으므로 NSExceptionDomains를 사용하여 도메인을로드 할 수 있습니다.NSAppTransportSecurity (예외 도메인 2 개)

나는 도메인 모두를 허용하도록 Info.plist 파일에 다음 코드를 사용하고 앱의 어떤 부분에서이기 때문에 나는이 개 도메인을 통해이 시간을 통과하고 싶습니다, 그러나 하위 도메인을

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

는 두 번째 도메인의 첫 번째 도메인과 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> 
(코드의 두 번째 세트에서 볼) 수