How to delete WKWebview cookies

后端 未结 13 1500
北荒
北荒 2020-11-27 04:18

For now I am doing like this

    NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [         


        
13条回答
  •  Happy的楠姐
    2020-11-27 04:52

    None of these options worked for me but I found one that did:

    let config = WKWebViewConfiguration()
    if #available(iOS 9.0, *) {
        config.websiteDataStore = WKWebsiteDataStore.nonPersistentDataStore()
    } else {
         // I have no idea what to do for iOS 8 yet but this works in 9.
    }
    
    let webView = WKWebView(frame: .zero, configuration: config)
    

提交回复
热议问题