views:

1765

answers:

3

Can an iPhone application read cookies previously stored by Safari Mobile?

+2  A: 

Although you have asked the same question twice before, here's one approach not yet mentioned...

This may be a little convoluted, but you can do Greasemonkey-esque things with a UIWebView. Something like this:

I've used this technique to enhance 3rd party pages in an iPhone app, but I'm not sure if it will read cookies from the same place as Safari mobile.

Worth a shot though?

Paul Dixon
Hi Paul,Thanks for the suggestion. Injecting the javascript to read document.cookies still passes back nothing afraid. But it was worth trying. Thought i Had it :)
TonyNeallon
A: 

Thanks for the negative marks. A guy gets wrong answer and marked down for asking question in different more meaningful way. Bad day all round. Going to work with Mobile Safari JD database as I can't seem to solve this one.

TonyNeallon
Rather than just asking the question again you should have updated the original question so it was more meaningful.
andynormancx
+5  A: 

To actually answer your question:

No.

Mobile Safari's cookies are not accessible from SDK apps. And each SDK app is given its own WebKit cache and cookie stores, so while cookies will persist within the same app, they aren't accessible betweeen apps.

Marco
Hi Marco, Thank man. Thats loud and clear enough even for me :) . You say each SDK app is given its own WebKit cache, I assume these can be accessed using HSHTTPCookieStorage class. Or am i still way off?
TonyNeallon
I'm not sure -- I've never tried.Try it. It's only a few minutes of work to embed a UIWebView, have it load a URL for a site that will give it a cookie, then try reading the cookies.I'd probably do it with Javascript if the webview was still accessible. (stringByEvaluatingJavascriptString:)
Marco