1. 程式人生 > >[iOS] Clearing UIWebView’s Cache in Swift

[iOS] Clearing UIWebView’s Cache in Swift

URLCache.shared.removeAllCachedResponses()
URLCache.shared.diskCapacity = 0
URLCache.shared.memoryCapacity = 0

if let cookies = HTTPCookieStorage.shared.cookies { 
    for cookie in cookies {
        HTTPCookieStorage.shared.deleteCookie(cookie)
    }
}