IOS Facebook, log out of the current FB user, then log in as another FB user

After reading the misses on SO here , here , here and others, my application still does not clear the previously registered Facebook user from my device so that I can then log in as another Facebook user.

The first time I called:

[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState state, NSError *error)] 

Safari opened on the Facebook login page with fields for email and password. After this first time, the only page that ever appears is the message "You have already resolved [appname]" with the "OK" and "Cancel" buttons. There are no other controls to switch the user. Even if I delete the application and clear the history and cookies in Safari, it still remembers.

My application leaves Facebook with the following function. The cookie deletion code is included due to the information I found in other messages, but the cookies are not returned, so it actually does nothing.

 - (void) logoutFaceBook { [[FBSession activeSession] closeAndClearTokenInformation]; NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; for(NSHTTPCookie *cookie in [storage cookies]) { NSString *domainName = [cookie domain]; NSRange domainRange = [domainName rangeOfString:@"facebook"]; if(domainRange.length > 0) { [storage deleteCookie:cookie]; }}} 
+5
source share

Source: https://habr.com/ru/post/1202902/


All Articles