Siva
Siva

Reputation: 1858

How to maintain and clear sessions in a UIwebview?

How to maintain and clear sessions in a UIwebview in iphone sdk

Upvotes: 3

Views: 1619

Answers (1)

Surjit Joshi
Surjit Joshi

Reputation: 3515

Just delete the cookies from the application. I used this for FBGraph as I was unable to logout from Facebook. You can use this.

    NSHTTPCookie *cookie;
    NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [storage cookies])
    {
        NSString* domainName = [cookie domain];
        NSRange domainRange = [domainName rangeOfString:@“yourDomainName"];
        if(domainRange.length > 0)
        {
            [storage deleteCookie:cookie];
        }
    }

Upvotes: 1

Related Questions