【问题标题】:Logout facebook sdk 3.08注销facebook sdk 3.08
【发布时间】:2012-09-28 08:40:46
【问题描述】:

我的 facebook 应用程序断开连接时遇到问题,这是一个简单的应用程序,请将照片上传到 facebook。 登录会带您注销 Safari,但不会完全注销,下一次登录会在我的帐户上进行。我在 php 中看到了几个选项,但没有工作。附上代码

- (void)viewDidLoad
{
[buttonPost setHidden:NO];

        FBLoginView *loginview = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions"]];

        loginview.frame = CGRectOffset(loginview.frame, 5, 5);
        loginview.delegate = self;

        [self.view addSubview:loginview];

        [loginview sizeToFit];
}

- (IBAction)Post:(UIButton *)sender{
    [FBRequestConnection startForUploadPhoto:self.imageScreen completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
        {
            [self showAlert:@"Photo Post" result:result error:error];
        }];
}

- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
    [self.buttonPost setHidden:YES];

    self.labelFirstName.text = nil;


}
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
    // first get the buttons set for login mode
   [self.buttonPost setHidden:NO];

}
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
    // here we use helper properties of FBGraphUser to dot-through to first_name and
    // id properties of the json response from the server; alternatively we could use
    // NSDictionary methods such as objectForKey to get values from the my json object
    self.labelFirstName.text = [NSString stringWithFormat:@"Hello %@!", user.first_name];
    // setting the profileID property of the FBProfilePictureView instance
    // causes the control to fetch and display the profile picture for the user
    self.loggedInUser = user;
}

- (void)showAlert:(NSString *)message
           result:(id)result
            error:(NSError *)error {

    NSString *alertMsg;
    NSString *alertTitle;
    if (error) {
        alertMsg = error.localizedDescription;
        alertTitle = @"Error";
    } else {
        NSDictionary *resultDict = (NSDictionary *)result;
        alertMsg = [NSString stringWithFormat:@"Successfully posted",
                    message, [resultDict valueForKey:@"id"]];
        alertTitle = @"Success";
    }

    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:alertTitle
                                                        message:alertMsg
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
    [alertView show];
}

【问题讨论】:

    标签: facebook logout


    【解决方案1】:

    这个问题与 Safari 的 cookie 和缓存机制有关。

    不幸的是,我知道让 Safari 忘记以前的登录凭据的唯一方法是清除设备设置中的 Cookie 和数据。

    我还没有真正尝试过,但我很确定当您使用 FBSession 而不是 FBLoginView 时也会发生这种情况。

    【讨论】:

      猜你喜欢
      • 2011-10-22
      • 2014-07-31
      • 2011-05-19
      • 2015-08-30
      • 2011-05-31
      • 2013-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多