菜鸟教程小白 发表于 2022-12-12 22:47:47

ios - 适用于企业应用程序的 Apple App Transport Security (ATS)


                                            <p><p>我正在开发一个企业应用程序。到目前为止,一切都在模拟器中运行良好,但是当我将它部署在物理设备上时它崩溃了。发生崩溃是因为应用程序通过“HTTP”而不是“HTTPS”连接到 Web 服务。 </p>

<p>我在 <code>info.plist</code> 文件中添加了 ATS 异常。我需要知道企业应用程序将在 2016 年(Apple 的截止日期)之后继续使用 <code>HTTP</code> 工作吗? </p>

<p>应用程序将托管在我们自己的服务器中,Apple 不会审查企业应用程序。 </p>

<p><strong>更新 1</strong>
我只需要知道企业应用程序在 2016 年之后是否会继续使用此 ATS 异常?</p>

<pre><code>    &lt;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&gt;
&lt;!DOCTYPE plist PUBLIC &#34;-//Apple//DTD PLIST 1.0//EN&#34; &#34;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#34;&gt;
&lt;plist version=&#34;1.0&#34;&gt;
&lt;dict&gt;
    &lt;key&gt;CFBundleDisplayName&lt;/key&gt;
    &lt;string&gt;xxxxxxxx&lt;/string&gt;
    &lt;key&gt;CFBundleIdentifier&lt;/key&gt;
    &lt;string&gt;com.xxxxxxx.xxx&lt;/string&gt;
    &lt;key&gt;CFBundleShortVersionString&lt;/key&gt;
    &lt;string&gt;1.0&lt;/string&gt;
    &lt;key&gt;CFBundleVersion&lt;/key&gt;
    &lt;string&gt;1.009&lt;/string&gt;
    &lt;key&gt;LSRequiresIPhoneOS&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;MinimumOSVersion&lt;/key&gt;
    &lt;string&gt;9.0&lt;/string&gt;
    &lt;key&gt;UIDeviceFamily&lt;/key&gt;
    &lt;array&gt;
      &lt;integer&gt;2&lt;/integer&gt;
    &lt;/array&gt;
    &lt;key&gt;UILaunchStoryboardName&lt;/key&gt;
    &lt;string&gt;LaunchScreen&lt;/string&gt;
    &lt;key&gt;UIMainStoryboardFile&lt;/key&gt;
    &lt;string&gt;Main&lt;/string&gt;
    &lt;key&gt;UIRequiredDeviceCapabilities&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;armv7&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;UISupportedInterfaceOrientations~ipad&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;UIInterfaceOrientationLandscapeLeft&lt;/string&gt;
      &lt;string&gt;UIInterfaceOrientationLandscapeRight&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;UIMainStoryboardFile~ipad&lt;/key&gt;
    &lt;string&gt;Main&lt;/string&gt;
    &lt;key&gt;UIAppFonts&lt;/key&gt;
    &lt;array&gt;
      &lt;string&gt;Fonts/Montserrat-Black.otf&lt;/string&gt;
      &lt;string&gt;Fonts/Montserrat-Bold.otf&lt;/string&gt;
      &lt;string&gt;Fonts/Montserrat-ExtraBold.otf&lt;/string&gt;
      &lt;string&gt;Fonts/Montserrat-Regular.otf&lt;/string&gt;
    &lt;/array&gt;

&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
&lt;dict&gt;
    &lt;key&gt;NSExceptionDomains&lt;/key&gt;
    &lt;dict&gt;
      &lt;key&gt;http://xxxxxxx.xxxxx.xxx&lt;/key&gt;
      &lt;dict&gt;
      &lt;key&gt;NSExceptionMinimumTLSVersion&lt;/key&gt;
      &lt;string&gt;TLSv1.0&lt;/string&gt;
      &lt;key&gt;NSExceptionRequiresForwardSecrecy&lt;/key&gt;
      &lt;false/&gt;
      &lt;key&gt;NSExceptionAllowsInsecureHTTPLoads&lt;/key&gt;
      &lt;true/&gt;
      &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
      &lt;true/&gt;
      &lt;/dict&gt;
    &lt;/dict&gt;
&lt;/dict&gt;

&lt;/dict&gt;
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>从 2017 年开始,任何 Apple App Store 提交的内容仍可申请应用传输安全 (ATS) 异常(exception),Apple 将对其进行审核。您将需要高度限制您的异常(exception)列表,并且不允许一揽子任意 http 加载。审阅者仍然可以拒绝您的提交并要求提供更多信息。</p>
<p>即允许通过非安全通道请求美国政府 NOAA 图像的应用<em><strong>可能</strong></em>因为 NOAA 目前不支持这些天气雷达图像的 HTTPS/SSL....再次,向上致 Apple 审阅者...</p>
<h3>WKWebView、UIWebView、WebView:</h3>
<blockquote>
<p><code>NSAllowsArbitraryLoadsInWebContent</code> lets you have a strict ATS dictionary but still load arbitrary content in a web view (WKWebView, UIWebView, WebView)</p>
</blockquote>
<h3>不安全的本地网络:</h3>
<blockquote>
<p><code>NSAllowsLocalNetworking</code> allows loading of local resources without disabling ATS for the rest of your app</p>
</blockquote>
<h3>已经加密的媒体内容:</h3>
<blockquote>
<p><code>NSAllowsArbitraryLoadsInMedia</code> disables all ATS restrictions for media that your app loads using the AV Foundation framework. Employ this key only for loading media that are already encrypted, such as files protected by FairPlay or by secure HLS, and that do not contain personalized information.</p>
</blockquote>
<h3>企业应用:</h3>
<p>这些没有得到 Apple 的审查,因此在未来可能的 iOS 版本禁止非安全流量之前,允许禁用 ATS,<em>但这远非最佳实践</em></p>
<ul>
<li>企业数据访问不安全?</li>
</ul>
<p>如果您的企业应用需要基于本地网络的非安全资源,请改用新的 <code>NSAllowsLocalNetworking</code> 异常(exception)。</p>
<p>如果您的企业应用程序需要通过公共(public)互联网获取的非安全企业资源,您可能会遇到超出 iOS 应用程序传输安全问题范围的安全问题。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 适用于企业应用程序的 Apple App Transport Security (ATS),我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/40522749/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/40522749/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 适用于企业应用程序的 Apple App Transport Security (ATS)