How can I delete all cookies from the NSHTTPCookieStorage.sharedHTTPCookieStorage file? The only methods I know about deleting one specified cookie, however, cookies are processed behind the scenes of NSURLSession. (Programming in Swift)
let cookieStore = NSHTTPCookieStorage.sharedHTTPCookieStorage() for cookie in cookieStore.cookies ?? [] { cookieStore.deleteCookie(cookie) }
Similarly, for fast 3.0+, xCode 8.0 +
let cookieStore = HTTPCookieStorage.shared for cookie in cookieStore.cookies ?? [] { cookieStore.deleteCookie(cookie) }
This gives the same result as the other answers, but with one line of code:
HTTPCookieStorage.shared.cookies?.forEach(HTTPCookieStorage.shared.deleteCookie)
Source: https://habr.com/ru/post/1245166/More articles:Python matplotlib legend in separate axis with gridspec - pythonHibernation: insert data using a foreign key - javaFind an element that has an attribute matching the template - javascriptsleep mode - how to save a parent with an individual child - ormPossible error in the implementation of unique_ptr - c ++How can I access a declared variable in bash while doing a Larvel Envoy job? - bashCan INSERT [...] ON CONFLICT be used for foreign key violations? - sqlHow to use every time gem starts a task at 2 a.m. and 2 p.m.? - ruby | fooobar.comHow to add Bold or Italic (INLINE) using Jade? * How to markdown - htmlBox2D hierarchical connection between bodies - c ++All Articles