2012-06-23 50 views
-4

可能重复:
iphone: facebook logout feature does not workingiphone:Facebook的注销功能在我的应用程序工作

我实现FB集成通过FBConnect 当我按下退出,它不会从Fb的注销我的代码如下:

- (void)viewWillAppear:(BOOL)animated 
{ 

    [super viewWillAppear:animated]; 
    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

    if (![[delegate facebook] isSessionValid]) { 

    } else { 
     [self showLoggedIn]; 
    } 

} 


- (IBAction)postMessageToWall:(id)sender { 


     currentAPICall = kDialogFeedUser; 
     SBJSON *jsonWriter = [[SBJSON new] autorelease]; 


     NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: 
                  @"TaxSmart Hello.",@"name",@"http://www.google.com",@"link", nil], nil]; 
     NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; 


     UIImage *img=[UIImage imageNamed:@"tick.png"]; 

     NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
             @"Piyush here.", @"name", 
             @"This is Great App.", @"caption", 
             @"FuNNNN.", @"description", 
             @"http://www.iTaxsmart.com/", @"link", 
             img.CIImage, @"picture", 
             actionLinksStr, @"actions", 
             nil]; 

     AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
     [[delegate facebook] dialog:@"feed" 
          andParams:params 
         andDelegate:self]; 
} 
当你注销按钮调用波纹管方法单击其工作,但只是检查你的userdefault关键

回答

0

..

- (void)fbDidLogout 
{  
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 
    [facebook invalidateSession]; 
    [defaults removeObjectForKey:@"FBAccessTokenKey"]; 
    [defaults removeObjectForKey:@"FBExpirationDateKey"]; 
    [defaults synchronize]; 
} 

希望,这帮助你.....

:)