Best to log out of iPhone FB app when done?
September 25, 2011 10:07 AM   Subscribe

How do cookies in iOS work? Is there a single cache of cookies, shared by any app that uses WebKit, or does each app have it's own cache?

The Facebook iPhone app essentially displays the mobile version of Facebook, but in an "app" frame. I know to log out of FB on my desktop and iPad, to prevent any "sharing," but do I need to do the same with the iOS app? Or are the cookies that enable the app separate from the Mobile Safari cookies, so I don't need to worry about them? I figured someone here would have a programmer's understanding of this...
posted by OneMonkeysUncle to Computers & Internet (4 answers total) 1 user marked this as a favorite
 
Best answer: Via http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSHTTPCookieStorage_Class/Reference/Reference.html

"iOS Note: Cookies are not shared among applications in iOS."

So, you shouldn't need to worry about logging out of the iOS app to prevent cookies from being shared between the Facebook app and other iOS apps.
posted by jeffch at 10:20 AM on September 25, 2011


Best answer: If you want a programmer's answer, each application has its own "cookie jar" in the [NSHTTPCookieStorage sharedHTTPCookieStorage] container.

Here's how you might take a quick look at the cookies in your application:

NSHTTPCookie *cookie;
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [cookieJar cookies]) {
  NSLog(@"%@", cookie);
}


Several methods are available for filtering and manipulation. Take a look at the NSHTTPCookieStorage documentation for accessing cookies, and the NSHTTPCookie documentation for accessing individual cookie properties.
posted by Blazecock Pileon at 12:00 PM on September 25, 2011


Response by poster: Thank you both. I only knew it was a potential architectural solution - I just knew someone here would have the iOS dope.
posted by OneMonkeysUncle at 2:23 PM on September 25, 2011


Bear in mind that if you open a web view FROM the app, cookies can be shared between the two via a small amount of code. Dunno if the FB app does that.
posted by zvs at 9:54 PM on September 25, 2011


« Older Help me HiveMind...   |   Help me jazz up some yard sale prints! Newer »
This thread is closed to new comments.