-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

ログアウトボタンをクリックすると、次のメソッドが機能しますが、userdefaultキーを確認してください..

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

願っています、これはあなたを助けます.....

:)

于 2012-06-23T10:15:33.813 に答える