views:

78

answers:

2

Hello all,

So I was just curious if the NSHTTPCookieStorage was persistent across applications, or local only to the current one. I want some cookies gathered in another app to be accessible in a search app. Is that how it works? Thanks!

PS: This is on the iPhone or iPad.

+2  A: 

For iOS, cookies are not shared across apps. Per Apple's documentation,

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

GregInYEG
Bah do you know of a way to make that happen? I tried saving the Cookie Storage into the UserPrefs but that doesn't seem to be working. I just need to make them global. I will remove them manually when I am done...
gabaum10
If you are wanting to be able to share cookies gathered in any other app (including ones that you didn't write), I think you're out of luck. Even if you did manage to save the cookie storage globally, all other apps would need to do the same thing. Apple does not make it easy for apps to communicate; they are each in their own security sandbox. You could try registering a custom URL handler in your search app, and encode your data into a custom URL in the app that has the cookie (if you wrote that app). See http://j.mp/WjLQu for more info about this approach.
GregInYEG
I figured out a workaround. Basically I just passed the creds through the URL scheme and recontacted the server to revalidate the credentials. Ugly and not super efficient, but it works and doesn't change the user experience at all. Thanks for the help!
gabaum10
A: 

Created a workaround where I just pass the credentials to the new app and reconnect to server. Not very efficient, but passable until something better is found...

gabaum10