views:

37

answers:

1

Hi Guys,

So I have poured over the ASI documentation but can't seem to find anywhere that says whether or not it is possible to capture the cookies from a post. Is there any method that rips out the session cookies into a dictionary or something from a request? Thanks!

A: 

Theres a Cookies dictionary in the the Cookies dir in the Cahe Dir in the sim (iPhone Sim/YOUR APP/Library/Caches/Cookies/Cookies.plist. I know thats where any cookies I get back are stored when I do any posts. Hope this helps.

octermircty
That is good to know, but I know that after looking through the ASI code, the request actually returns an array of cookies, I just need to figure out how to access them. I also think that when it comes across one in its parsing of the headers, it adds it to the global application state. I will keep you posted if I find any more info. Thanks man!
gabaum10
Yeh the array is within the Cookies plist so to access it you can use this:NSArray* cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];That'l give you all the cookies for your app and if you want to get the cookies from a specific URL in the cookies array you can use this:NSArray* cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:YOURURL];
octermircty