Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook iOS SDK, Logout (CloseAndClearTokenInformation) not working?
    primarykey
    data
    text
    <p>I've set up the Facebook iOS SDK with my app, and everything works fine. I can login using Facebook, but for some reason when I try and click my "Logout" button (top right, see image below), it doesn't do anything. I'm using a Storyboard to create my app (the login xib opens on top of my existing storyboard), and everything in my AppDelegate seems correct. What am I missing? See snippets of code below.</p> <p><strong>AppDelegate.m</strong></p> <pre><code> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.mainViewController = [[SSViewController alloc] initWithNibName:@"SSViewController" bundle:nil]; self.navController = [[UINavigationController alloc] initWithRootViewController:self.mainViewController]; self.window.rootViewController = self.navController; [self.window makeKeyAndVisible]; if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) { // Yes, so just open the session (this won't display any UX). [self openSession]; } else { // No, display the login page. [self showLoginView]; } return YES; } - (void)showLoginView { UIViewController *topViewController = [self.navController topViewController]; UIViewController *modalViewController = [topViewController modalViewController]; // If the login screen is not already displayed, display it. If the login screen is // displayed, then getting back here means the login in progress did not successfully // complete. In that case, notify the login view so it can update its UI appropriately. if (![modalViewController isKindOfClass:[SSLoginViewController class]]) { SSLoginViewController* loginViewController = [[SSLoginViewController alloc] initWithNibName:@"SSLoginViewController" bundle:nil]; [topViewController presentViewController:loginViewController animated:NO completion:nil]; } else { SSLoginViewController* loginViewController = (SSLoginViewController*)modalViewController; [loginViewController loginFailed]; } } </code></pre> <p><strong>SSViewController.m</strong></p> <pre><code>-(void)logoutButtonWasPressed:(id)sender { [FBSession.activeSession closeAndClearTokenInformation]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStyleBordered target:self action:@selector(logoutButtonWasPressed:)]; </code></pre> <p><img src="https://i.stack.imgur.com/5QXKB.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload