I am currently using Facebook SDK 3.5 for facebook login in my native iOS app. I have referred sample iOS codes by facebook and implemented my login in the same way. Everything works absolutely fine until the Logout process. I am able to logout from FB but NOT completely. When i tap on the login button again, FB is showing a webpage with my credentials again and asking me to login with the same. I'v heard people say that it is a problem with Safari, so i manually deleted all the safari cookies and tried to login again, but to no avail. Is there any alternative way in which i can do this?? I also referred SOF for solutions and implemented the answers listed below, but they are not working out either.
Login Logout issue with facebook iOS sdk
EDIT -Posting the settings tab screenshot of the Facebook app page
Although I haven't used Facebook SDK but I have used third Party SDK Socialize and was facing the same issue with Facebook logout. I was unable to logout and even if I did, it was showing my credentials when I tried to log back in.
I followed following steps which is irrespective of the SDK you are using (Be it sharekit, socialize or native facebook sdk)
1.In the advance settings of the app on facebook, i enabled native/desktop app
2.Disable SSO/DeepLinking in basic settings --> native iOS app. Earlier there used to be different options but now only DeepLinking is provided.
3.Add de-auth callback url in advance settings. It could be anything [For eg http://google.com]
4.Add the following piece of code where the user clicks LogOut button:
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie in [storage cookies])
{
NSString* domainName = [cookie domain];
NSRange domainRange = [domainName rangeOfString:@"facebook"];
if(domainRange.length > 0)
{
[storage deleteCookie:cookie];
}
}
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.