【问题标题】:iphone: Facebook logout feature is not work in my app [duplicate]iphone:Facebook注销功能在我的应用程序中不起作用[重复]
【发布时间】:2012-06-23 07:32:20
【问题描述】:

可能重复:
iphone: facebook logout feature does not working

我正在通过 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];
}

【问题讨论】:

    标签: iphone xcode facebook ios5


    【解决方案1】:

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

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

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

    :)

    【讨论】:

      猜你喜欢
      • 2012-06-25
      • 2019-04-06
      • 1970-01-01
      • 2018-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-11
      相关资源
      最近更新 更多