Vasu
Vasu

Reputation: 41

How to delete safari cookies in programatically

I have worked on Flickr. In that i have want to clear the safari cookies, when calling the flick login screen in safari.how to clear the cookies.please help me.

Upvotes: 0

Views: 1310

Answers (2)

Andrea
Andrea

Reputation: 26383

Try with that, but is a pretty raw clean

    NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [storage cookies]) {
        [storage deleteCookie:cookie];
    }

Upvotes: -1

rckoenes
rckoenes

Reputation: 69499

You can't, apps run in a sandbox and can't access other apps directly.

If you mean with Safari a UIWebView then you can delete them via the NSHTTPCookieStorage:

NSHTTPCookieStorage *cookieStorage =  [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie  *cookie in [cookieStorage cookies]) {
   [cookieStorage deleteCookie:cookie];
}

Upvotes: 2

Related Questions