Re: Some advice re. "saving" a variable so it is accessible to all classes/methods
Re: Some advice re. "saving" a variable so it is accessible to all classes/methods
- Subject: Re: Some advice re. "saving" a variable so it is accessible to all classes/methods
- From: "Owen Yamauchi" <email@hidden>
- Date: Mon, 30 Jun 2008 10:03:17 -0700
On Mon, Jun 30, 2008 at 9:46 AM, Michael Kaye <email@hidden> wrote:
> 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.
I don't see that the login object needs to be released at all.
Logically, the login object is the one responsible for obtaining the
session id, so it "owns" the session id. Maybe have the login object
be a singleton, so you can always access the instance, and give it an
accessor for the session id. Conceptually, think of the singleton
login object as "authentication to the server". It can give an opaque
certificate of authentication, in the form of the session id.
Owen
_______________________________________________
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