-4

可能重复:
iphone:facebook 注销功能不起作用

我正在通过 FBConnect 实现 FB 集成当我按下注销按钮时,它不是从 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];
}
4

1 回答 1

0

当您单击注销按钮调用波纹管方法时,它的工作但只需检查您的用户默认键..

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

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

:)

于 2012-06-23T10:15:33.813 回答