Some advice re. "saving" a variable so it is accessible to all classes/methods
Some advice re. "saving" a variable so it is accessible to all classes/methods
- Subject: Some advice re. "saving" a variable so it is accessible to all classes/methods
- From: Michael Kaye <email@hidden>
- Date: Mon, 30 Jun 2008 17:46:34 +0100
Hi all,
I hope you can offer a newbie some advice. I've been reading and
reading the Design patterns documentation but have got myself somewhat
confused. I hope if I explain what I'm trying to achieve someone can
offer me some advice.
Basically I have an application that interrogates a web based database
and displays the requested data accordingly.
1) When the app launches the first view displayed is a "login" screen
with a username and password field.
2) if the user clicks the login button (and everything is OK such as
there is a network connection etc), a url is sent to the web server
and it responds with an XML response
(in fact this is handled by a "loginXMLReader" class I have a created
which handles sending the request, parsing the response and returns a
BOOL indicating whether login was successful).
3) If the login is successful, theML response also contains an element
called "sessionID" which contains a string value which must be passed
to subsequent url request/queries
So my question (finally) is where do I store the sessionid variable so
it is accessible through out all classes and for as long as the app is
running?
My current approach is to save the value in an Extern NSString but I'm
not convinced this is correct. I feel like the class that handles the
login ought to maintain it some how, but if so how do I keep it alive
and accessible after I release the login class object?
I hope makes some sense and hopefully someone can provide me with a
few pointers.
TIA. Michael.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden