gpt4 book ai didi

ios - 创建一个非跟踪应用程序内网络浏览器

转载 作者:可可西里 更新时间:2023-11-01 03:28:39 25 4
gpt4 key购买 nike

我正在尝试创建一个不在本地跟踪或存储任何浏览历史记录的 WebView (作为练习)。
我已经做到了,当 webview 关闭时,它调用以下

[[NSURLSession sharedSession]resetWithCompletionHandler:^{}];

但我发现诸如谷歌搜索历史之类的东西在 session 之间以某种方式持续存在。我也试过通过

单独清除cookies
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
[[NSUserDefaults standardUserDefaults] synchronize];

还是不行。创建新的 WebView 时,Google 搜索仍会显示。
有谁知道删除谷歌用来将搜索历史匹配回我的标识符的方法吗?我担心它类似于包标识符,防止被读取可能有点棘手。
任何想法表示赞赏。
此致,
卢克

最佳答案

尝试为 WKWebViewConfigurationWKWebsiteDataStore 设置 nonPersistentDataStore

这是一个示例代码片段

let webVuConfiguration = WKWebViewConfiguration()
webVuConfiguration.websiteDataStore =WKWebsiteDataStore.nonPersistentDataStore()
let webView = WKWebView(frame: webviewRect, configuration: webVuConfiguration)

关于ios - 创建一个非跟踪应用程序内网络浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42994553/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com