In an app that we are currently working on we are using a UIWebView to log the user into Facebook. We have had a host of problems with the FB integration which I will go into another time but one problem we had was that login details where being cached within the application. This meant that whoever was the first person to log into the application stayed logged in whether they liked it or not. Even trying to open another UIWebView to the FB logout page didn’t work. What did work however was to delete the cookies that FB had stored with the Application directory.
Here is the code to do it.
NSHTTPCookieStorage *jar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray *cookies = [jar cookies];
for (id cookie in cookies) {
[jar deleteCookie:cookie];
}
It might seem like overkill to delete all the cookies rather than just the ones related to Facebook but I couldn’t get it to work for just the FB domain, I had to delete them all.
Stu





There are no comments yet