简体   繁体   中英

Clearing of app cache in iOS works for Google+ login, but doesn't work for Facebook

In my app I implemented login using Facebook and Google+. Given scenario:

  • I logged in using fb account 1
  • I would like to login using fb account 2, so I log out
  • On safari view I get message "You have already granted permissions to your app"

Which is ok end expected. User needs to log out from Safari browser. But I would like to do it by myself by cleaning cookies and URLCache:

    URLCache.shared.removeAllCachedResponses()
    URLCache.shared.diskCapacity = 0
    URLCache.shared.memoryCapacity = 0

    if let cookies = HTTPCookieStorage.shared.cookies {
        for cookie in cookies {
            HTTPCookieStorage.shared.deleteCookie(cookie)
        }
    }

This code erases data for Google+, but doesn't change anything for Facebook. Is it the expected behavior? Why? If no - what is the way to clean Facebook data as well?

You can try this way. When you use FB to login you can first use logout

FBSDKLoginManager *manager = [[FBSDKLoginManager alloc] init];
//manager.loginBehavior=FBSDKLoginBehaviorWeb;
[manager logOut];

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM