Reputation: 255
I have an iOS app where I'm trying to implement functionality so that a user who has logged in to QuickBlox via Facebook (via QBUsers logInWithSocialProvider
)can logout and then log in as a different Facebook user.
I'm logging out using
[[QBChat instance] logout];
[QBUsers logOutWithDelegate:nil];
but when I login subsequently (again via QBUsers logInWithSocialProvider
) the Facebook UI is not displayed - I'm logged in as the previous user.
How can I log out so that the user is disconnected from the facebook account they were previously logged in as and are able to login under a different account?
Upvotes: 1
Views: 252
Reputation: 18346
You have to clear cookies to completely do facebook logout
Try something like this:
// Clear cookies
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];
}
}
Upvotes: 2