Q:

How should I use Facebook object across several viewcontrollers

I have been playing with the Facebook iOS API the past days and I got some questions. If I have two distinct view controllers that both need to use the Facebook object how should I share the object? And is it necessary to share it at all? I have been thinking of making a singleton. What I thought of doing was making a class "SocialMedia" that has a class method named "sharedFacebook". 
Then I have another class named PREFIXFacebook where I conform to the session protocol and make an object. This class has an attribute named facebook. Then I instantiate this class in the SocialMedia class and send the method "facebook" to it and assign the returned object to the static Facebook variable in SocialMedia. Is that bad design? I have not been doing much singletons before, and I don't even know if it is necessary, but I don't want to duplicate the code.
Another approach would be to do this in the app delegate, but I read a post here on stack overflow and heard in one of the stanford iOS videos that it is bad to do such things with the global. Any thoughts?

A:

As with most things, global variables are not bad in moderation. If you abuse them, you will be running short on Memory, but I think it is justified in this case. A singleton is essentially a global variable and I believe your plan here is a good one. Not only will it help you with Facebook, but it will help with other single-login sites such as Twitter and Google+.
To keep things with a small footprint, you don't want to store a million things in the Singleton class. Try to only store the bare minimum needed to avoid re-authenticating. This probably means only the Facebook object itself, and not an additional wrapper class for it.

