显示网络图像是使用 NSAllowsArbitraryLoads 的正当借口?

Displaying web images valid excuse for using NSAllowsArbitraryLoads?

到目前为止,我们只在应用程序的 ATS 设置中设置 NSAllowsLocalNetworking

但是,现在我们的聊天功能中引入了 link 预览。用户发布的链接用于创建包含 linked 网页图像和网站图标的预览。

问题是用户发布的某些 link 具有 favicons/images 明文 (HTTP) 格式。

这是使用 NSAllowsArbitraryLoads 的正当理由吗?

我不是 100% 确定 ATS 执法的当前状态以及用户生成的 links 是否是可以接受的例外。

(我们正在使用 Kingfisher 库在 UIImageView 中显示这些图像,因此无法使用 AVFoundation NSAllowsArbitraryLoadsForMedia。)

你不会被拒绝的。 Apple 在此截止日期的最后更新是这样的:

At WWDC 2016 we announced that apps submitted to the App Store will be required to support ATS at the end of the year. To give you additional time to prepare, this deadline has been extended and we will provide another update when a new deadline is confirmed.

https://developer.apple.com/news/?id=12212016b

虽然我不确定 Apple 会认为什么是正当理由(因为他们还没有开始强制执行,所以我们没有信息可以参考),但在应用程序中包含用户驱动的内容似乎是一个那些需要更广泛的 NSAllowsArbitraryLoads 例外的场景。

为了向 Apple 表明您已竭尽所能保护任何通信,我建议您采用与最常见技术相反的方法。通常,应用程序将启用 ATS(通过将 NSAllowsArbitraryLoads 的默认值保留为 NO),同时添加为某些域禁用 ATS 的异常域。如果我是你,我会做相反的事情——将 NSAllowsArbitraryLoads 设置为 YES,因为你不知道哪些 URLS 可能需要 ATS 例外,然后为你在应用程序中控制的域添加例外域(假设有一些主服务器,你从中获取大部分应用程序内容)。这可确保使用 ATS 标准保护与您的服务器的通信,而所有已知服务器之外的服务器将不受 ATS requirements.So 关闭 ATS,但为您控制的域重新打开它。

从这个 great article 关于一些常见的 ATS 配置,您可以看到如何以这种方式进行设置 ("Example C: ATS disabled, with some exceptions"):

对我来说,这对 Apple 来说是一个好兆头,表明您正在尽可能地遵守 ATS 的精神。