I have a facebook variable in my ViewController that I want to refer to in my AppDelegate method. How do I do this?
In my AppDelegate I want to put this, since it uses UIApplication and all other refs are in this class:
// For iOS 4.2+ support
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [facebook handleOpenURL:url];
}
The facebook variable is in my ViewController .h file:
#import <UIKit/UIKit.h>
#import "FBConnect.h"
@interface ImportPicViewController : UIViewController <FBSessionDelegate, FBDialogDelegate>{
Facebook *facebook;
}
@property (nonatomic, retain) Facebook *facebook;
@end
and synthesized in the .m file:
@implementation ImportPicViewController
@synthesize facebook;
But it is alloc init in the ViewController:
- (void)viewDidLoad
{
[super viewDidLoad];
facebook = [[Facebook alloc] initWithAppId:@"224207854355440" andDelegate:self];
Any idea?