Last active
August 29, 2015 14:23
-
-
Save brocoo/f1c5221a388caf5ab3a7 to your computer and use it in GitHub Desktop.
Swift 1.2 function to flush shared cookies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func flushCookies() { | |
let storage = NSHTTPCookieStorage.sharedHTTPCookieStorage() | |
if let cookieJar = storage.cookies as? [NSHTTPCookie] { | |
for cookie in cookieJar { storage.deleteCookie(cookie) } | |
} | |
NSUserDefaults.standardUserDefaults().synchronize() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment