I am using my App to login to a website and access information from there. I have a few questions...
I am using multiple files / screens to access information after I have logged in. On the pag开发者_Python百科e which does the login, I am able to output all the Cookie data to an NSLog. The Cookie consists of a SESSIONID. I am then able to navigate through other screens which require the SESSION. Obviously the SESSION is still intact, but how can I get that Cookie data while on other screens?
More specifically, if I am on a later screen and need to put the SESSIONID into a variable so I can use it in the code, how would I extract that SESSIONID from the Cookie and put it into a variable that I can use?
I have been banging my head on this for a few days now and been searching all over. The guys at pragprog.com suggested I try here.
Thanks for any help you can provide.
You could put an instance variable in your application delegate with a readwrite
property. Then you would set its value to the session id derived from the cookie. As this delegate is accessible to all "screens" (view controllers?) the instance variable would be accessible, as well.
精彩评论