This is one of the test cases that needs to be checked.
- Someone removes your application from Facebook through the application settings and revises your application. Your application should detect this and call the person to enter the system. Go to your application and click “Sign in to Facebook”, click “OK” to accept read permissions (and click “OK” again to accept write permissions, if applicable). Go to the application settings on Facebook and delete the application. Repeat steps 1-2 and make sure it works on Facebook.
I have not found a way to achieve this. When I uninstall the application on facebook, my iOS still thinks the session is valid. There is a discussion here at Stackoverflow. But the solution provided does not seem to work.
This is what I still logged into. But I can’t detect when the user uninstalled the application on facebook. Any tips please?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) {
NSLog(@"Found a cached session");
[FBSession openActiveSessionWithReadPermissions:@[@"public_profile"]
allowLoginUI:NO
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
[self sessionStateChanged:session state:state error:error];
}];
} else {
UIButton *loginButton = [self.customLoginViewController loginButton];
[loginButton setTitle:@"Log in with Facebook" forState:UIControlStateNormal];
}
}
- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
{
if (!error && state == FBSessionStateOpen){
NSLog(@"Session opened");
[self userLoggedIn];
return;
}
if (state == FBSessionStateClosed || state == FBSessionStateClosedLoginFailed){
NSLog(@"Session closed");
[self userLoggedOut];
}
}
source
share