I need to install my app on a totem in an exhibition stand. The application flow is:
1) User takes a photo
2) User taps on a FBLoginView
that open the Facebook app. The user makes the login and the Facebook app automatically returns to my app.
FBLoginView *loginView = [[FBLoginView alloc] initWithReadPermissions:
@[@"public_profile", @"email", @"user_friends"]];
// Align the button in the center horizontally
loginView.delegate = self;
loginView.frame = CGRectOffset(loginView.frame, (self.view.center.x - (loginView.frame.size.width / 2)), 5);
[self.view addSubview:loginView];
3) User taps on UIButton
for post the photo and the Facebook app is opened again. The code for sharing is the following
NSArray* images = @[
@{@"url": [UIImage imageNamed:@"zoom_out_(25x25)"], @"user_generated" : @"true" }
];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:@"https://example.com/cooking-app/meal/Lamb-Vindaloo.html" forKey:@"meal"];
[action setObject:images forKey:@"image"];
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:@"fbsdktoolkit:cook"
previewPropertyName:@"meal"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
[[FBSession activeSession] closeAndClearTokenInformation];
} else {
[[FBSession activeSession] closeAndClearTokenInformation];
}
}];
4) The user goes away and another user (with another Facebook profile) restart the flow from point 1.
The problem is that when the share action is done I delete the current session with [[FBSession activeSession] closeAndClearTokenInformation];
. The FBLoginVIew
change its text to "Log in with Facebook" but if I tap to FBLoginVIew
again the Facebook app is already logged and I can't make a login with another profile.
I need to know if there is a way to logout the Facebook app programmatically.
Thank you very much!