Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8041711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:18:45+00:00 2026-06-05T04:18:45+00:00

In my app Am using Facebook. Am integrated FB with my app. Login also

  • 0

In my app Am using Facebook. Am integrated FB with my app.
Login also happening correctly. But when am trying to logout it is showing logout successful in fbDidLogout but when we try to login again means it is just showing login page and logging with previously entered username and password.

How can we logout correctly.

Any one can help or suggest

Here is my code

This is Login Logout Button Action

- (IBAction)LoginOrLogout 
{
// If the user is not connected (logged in) then connect.  Otherwise logout.
if (!isConnected)
{

    // Set the permissions.
    // Without specifying permissions the access to Facebook is imposibble.
    permissions = [[NSArray arrayWithObjects:@"read_stream", @"publish_stream", nil] retain];

    // Set the Facebook object we declared. We’ll use the declared object from the application
    // delegate.
    facebook = [[Facebook alloc] initWithAppId:@"329082513817407" andDelegate:self];



    [btnPublish setHidden:NO];
    [messageTextField setHidden:NO];

    [facebook authorize:permissions];

    // Change the lblUser label's message.
    [lblUser setText:@"Please wait..."];

    isConnected = YES;
     [self setLoginButtonImage];
}
else 
{
    [facebook logout:self];
    [messageTextField setHidden:YES];

    [lblUser setText:@"Tap on the Login to connect to Facebook"];
    isConnected = NO;
    [self setLoginButtonImage];
}
}

These are the other methods

-(void)fbDidLogin
{
// Save the access token key info.
[self saveAccessTokenKeyInfo];

// Get the user's info.
[facebook requestWithGraphPath:@"me" andDelegate:self];
}

 -(void)fbDidNotLogin:(BOOL)cancelled
{
UIAlertView *al = [[UIAlertView alloc] initWithTitle:@"Tonify" message:@"Login cancelled." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[al show];
[self LoginOrLogout];
}

-(void)fbDidLogout
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSLog(@"defaults fbDidLogout  ........%@",defaults);
if ([defaults objectForKey:@"FBAccessTokenKey"]) 
{
    [defaults removeObjectForKey:@"FBAccessTokenKey"];
    [defaults removeObjectForKey:@"FBExpirationDateKey"];
    [defaults synchronize];
}
NSLog(@"defaults fbDidLogout ........%@",defaults);
NSLog(@"logout success!");

// Keep this for testing purposes.
NSLog(@"Logged out Succes");

// Hide the publish button.
[btnPublish setHidden:YES];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:18:49+00:00Added an answer on June 5, 2026 at 4:18 am

    Use this method:

    -(void)fbDidLogout
    {
      NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
      NSLog(@"defaults fbDidLogout  ........%@",defaults);
      if ([defaults objectForKey:@"FBAccessTokenKey"]) 
      {
          [defaults removeObjectForKey:@"FBAccessTokenKey"];
          [defaults removeObjectForKey:@"FBExpirationDateKey"];
          [defaults synchronize];
      }
    
      // Hide the publish button.
      [btnPublish setHidden:YES];
    
       NSHTTPCookie *cookie;
       NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
       for (cookie in [storage cookies])
       {
         NSString* domainName = [cookie domain];
         NSRange domainRange = [domainName rangeOfString:@"facebook"];
         if(domainRange.length > 0)
         {
           [storage deleteCookie:cookie];
         }
       }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a facebook app using a lot of Javascript that doesn't work correctly
I am trying to write a facebook app using app-engine-patch and pyFacebook. I am
I'm trying to integrate a Facebook send button into my site using Facebook app.
I am developing app using facebook API. When I push 'login' button from my
I have integrated the facebook in my app using http://sourceforge.net/projects/facebook-bb-sdk , it work fine
I'm trying to retrieve in my android app(in which I have facebook integrated )
I integrated facebook app using sharekit by giving the FB Secret key and session
I have downloaded Prabir's application ASP.NET MVC Canvas App using Facebook C# SDK showing
I have integrated the Facebook SDK in my app using the official facebook connect
I'm developing a web app integrated with facebook and I'm using the request dialog

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.