在 XCode 6.3.2 上使用 WKWebsiteDataStore

Using WKWebsiteDataStore on XCode 6.3.2

我试图在 WKWebsiteDataStore 的帮助下删除我的 wkwebview cookie,但我的 XCode 6.3.2 不支持 WKWebsiteDataStore。我不愿意升级到 XCode 7. 是否有任何其他选项可以清除 WKWebview 中的 cookie?

很遗憾:没有。其实不是Xcode版本的问题,而是iOS版本的问题。正如您在 Apple Documentation 中看到的那样,WKWebsiteDataStore 仅适用于 iOS >= 9.0。所以,如果你想使用 WKWebsiteDataStore,你必须将 iOS 9 设为 Deployment Target

但是,如果您想使用 iOS9,则必须将 XCode 更新为 Xcode7。实际上,您不能在 Xcode < 7 ().

上使用 iOS 9

所以,总结一下:如果你想使用WKWebsiteDataStore:将你的Xcode更新为7+并设置iOS > = 9.0 作为您的部署目标。

编辑: 经过一些研究,您似乎有另一种方法可以在 iOS > 8.2 上删除 cookie。看看at this answer。但我仍然认为最好的解决方案是进行更新:)