While implementing facebook SSO, calling logout function of facebook ios sdk is not clearing user Credentials and it does not ask to login next time.
I Used Graph Api.....
- (IBAction)loginButtonPressed:(id)sender {
NSString *client_id = @"dsfgdgfgfgdfgvdfg";
//alloc and initalize our FbGraph instance
self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id];
//begin the authentication process.....
[fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:)
andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"];
}
- (void)logOutButtonPressed {
NSLog(@"logout");
fbGraph.accessToken = nil;
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];
}
}
[self loginButtonPressed:nil];
}
And This code is WORKING FINE..TRY THIS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With