Logout facebook sdk 3.08

自作多情 提交于 2019-12-11 02:17:24

问题


I have a problem with the disconnection of my facebook app is a simple app, upload a photo to facebook. To login brings you do logout safari but not completely log off and the next login it does on my account. I have seen several options in php but not working. code attached

- (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];
}

回答1:


This problem is related to Safari's cookies and cache mechanisms.

Unfortunately the only way I know to get Safari to forget about the previous login credentials is to clear the Cookies and Data in the devices Settings.

I haven't really tried but I am quite sure that this also happens when you use the FBSession as opposed to the FBLoginView.



来源:https://stackoverflow.com/questions/12636530/logout-facebook-sdk-3-08

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!