应用传输安全
应用传输安全 (ATS) 是一项强制使用安全连接的隐私设置功能。默认情况下,系统会为新应用启用该功能。
当不符合 ATS 标准的应用试图使用 HTTP 投放广告时,系统将显示以下日志消息:
因为不安全,应用传输安全功能已阻止加载明文 HTTP (http://) 资源。您可以在应用的 Info.plist
文件中配置临时例外情况。
如需停用 ATS 限制,请将以下例外情况添加到应用的 Info.plist
:
NSAllowsArbitraryLoadsForMedia
NSAllowsArbitraryLoadsInWebContent
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
您需要添加 NSAllowsArbitraryLoadsForMedia
和 NSAllowsArbitraryLoadsInWebContent
键,以确保您的广告不受 ATS 影响。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-08。
[null,null,["最后更新时间 (UTC):2025-02-08。"],[[["App Transport Security (ATS) enforces secure connections and is enabled by default for new apps, blocking cleartext HTTP resource loads for enhanced security."],["To avoid ATS restrictions and ensure ad serving functionality, developers need to include `NSAllowsArbitraryLoadsForMedia` and `NSAllowsArbitraryLoadsInWebContent` exceptions within their app's `Info.plist` file."],["These exceptions allow media and web content to bypass ATS restrictions, preventing disruption to ad delivery."]]],["App Transport Security (ATS) enforces secure connections and is enabled by default. Non-compliant apps using HTTP trigger a log message indicating blocked insecure resource loads. To disable ATS restrictions for media and web content, add `NSAllowsArbitraryLoadsForMedia` and `NSAllowsArbitraryLoadsInWebContent` keys set to `true` within the app's `Info.plist` file, under the `NSAppTransportSecurity` dictionary. These exceptions are essential to prevent ads from being affected by ATS.\n"]]