使用 NSCrossWebsiteTrackingUsageDescription 请求用户为 WKWebView 禁用 ITP
Using NSCrossWebsiteTrackingUsageDescription to request user disable ITP for WKWebView
iOS 14 版本正在捕获第三方 auth/device cookie,看来我们需要禁用智能跟踪预防 (ITP)。可用的文档 (planet.webkit.org) 建议我们在项目的 Info.plist:
中设置特定的设置键和“Purpose String”
Intelligent Tracking Prevention in WKWebView
Additionally in iOS 14.0 and macOS Big Sur, Intelligent Tracking Prevention (ITP), is enabled
by default in all WKWebView applications. [...]
In some extreme cases, users might need to disable ITP protections,
for example when relying on web content outside of the app developer’s
control. Applications can signal the need to allow users to disable
ITP by adding a Purpose String for the key
NSCrossWebsiteTrackingUsageDescription
to the app’s Info.plist. When
present, this key causes the application’s Settings screen to display
a user control to disable ITP. The setting cannot be read or changed
through API calls.
我相信我已经做到了:
<!-- Info.plist -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>NSCrossWebsiteTrackingUsageDescription</key>
<string>Allow authentication and device trackers.</string>
...
</dict>
</plist>
我希望显示一个模态 iOS 对话框,请求使用该文本解释权限请求的权限。但是,我从未收到任何对话或请求,ITP 仍在干扰 auth/device 识别过程。
这可能取决于以下内容在实践中的含义。
this key causes the application’s Settings screen to display a user control to disable ITP.
我如何让这个过程工作并允许禁用 ITP?
此处的解决方案是添加允许 iOS 设备从设备的“设置”应用程序显示设置页面的设置包(或类似包)。本质上,遵循 Settings.bundle
tutorial 和 NSCrossWebsiteTrackingUsageDescription
的 Info.plist
设置将触发下面屏幕截图中的设置切换。
但是不确定为什么它不使用“目的字符串”值。
iOS 14 版本正在捕获第三方 auth/device cookie,看来我们需要禁用智能跟踪预防 (ITP)。可用的文档 (planet.webkit.org) 建议我们在项目的 Info.plist:
中设置特定的设置键和“Purpose String”Intelligent Tracking Prevention in WKWebView
Additionally in iOS 14.0 and macOS Big Sur, Intelligent Tracking Prevention (ITP), is enabled by default in all WKWebView applications. [...]
In some extreme cases, users might need to disable ITP protections, for example when relying on web content outside of the app developer’s control. Applications can signal the need to allow users to disable ITP by adding a Purpose String for the key
NSCrossWebsiteTrackingUsageDescription
to the app’s Info.plist. When present, this key causes the application’s Settings screen to display a user control to disable ITP. The setting cannot be read or changed through API calls.
我相信我已经做到了:
<!-- Info.plist -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
...
<key>NSCrossWebsiteTrackingUsageDescription</key>
<string>Allow authentication and device trackers.</string>
...
</dict>
</plist>
我希望显示一个模态 iOS 对话框,请求使用该文本解释权限请求的权限。但是,我从未收到任何对话或请求,ITP 仍在干扰 auth/device 识别过程。
这可能取决于以下内容在实践中的含义。
this key causes the application’s Settings screen to display a user control to disable ITP.
我如何让这个过程工作并允许禁用 ITP?
此处的解决方案是添加允许 iOS 设备从设备的“设置”应用程序显示设置页面的设置包(或类似包)。本质上,遵循 Settings.bundle
tutorial 和 NSCrossWebsiteTrackingUsageDescription
的 Info.plist
设置将触发下面屏幕截图中的设置切换。
但是不确定为什么它不使用“目的字符串”值。