在实现facebook SSO时,调用facebook ios sdk的注销功能不会清除用户凭据,也不会要求下次登录。

最佳答案

我使用了 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];
}

并且此代码工作正常..试试这个

关于iphone - 调用 facebook ios sdk 的注销功能不会清除用户凭据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6068205/

10-09 22:30