views:

51

answers:

1

I am attempting to write a Facebook integration in an iPhone app I'm working on. I have it logging in just fine, but I don't like the idea of being able to turn a feature on without being able to turn it off. So, in working on the logout functionality, I have been caught in a snag.

- (IBAction) logoutClicked:(id)sender {
    if (fbLoggedIn)
    {
        FBSession * mySession = [FBSession session];

        [mySession logout];
    }
}

- (void)sessionDidLogout:(FBSession*)session
{
    NSLog(@"Session logged out.");
    [theLoginButton setTitle:@"Facebook Time!" forState:UIControlStateNormal];
    fbLoggedIn = FALSE;
    theLogoutButton.enabled = NO;
    theLogoutButton.alpha = 0;
}

The logoutClicked method responds to a button in my xib. The delegate method is not getting called. I have tried setting the Facebook session as a property in my ViewController in order to store/access the data across methods, but that didn't seem to work either. Anybody have any solutions?

A: 

Is the sessionDidLogout implemented in a class which implements FBSessionDelegate? And is it an instance of that class that you passed as a delegate when creating the session with the method [FBSession sessionForApplication:@"XXX" secret:@"YYY" delegate:(DELEGATE)] ?

Adri