views:

33

answers:

2

I've tried passing in the Facebook object which I named facebook as an argument into classes that rely on it. However, is there a way to use it in a sort of global way so that way I don't have to keep on passing it around between objects?

+1  A: 

Well, I see several ways:

  • Create a public static method in a class that contains facebook object:

    + (id)getSharedFacebookObject {
        return facebook;
    }
    
  • The second way is to use app delegate:

    MyAppDelegate *appDel = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
    id Facebook = appDel.facebook;
    
kovpas