解析Twitter登录 - 选择哪个Twitter帐户

时间:2014-02-20 17:39:07

标签: ios iphone twitter parse-platform

我有一个iOS应用程序,允许用户使用他们的Twitter帐户登录。它使用Parse API来执行此操作。以下是处理登录的代码:

- (IBAction)twitterAuthButtonPressed:(id)sender {
    [PFTwitterUtils logInWithBlock:^(PFUser *appUser, NSError *error) {
        if (!appUser) return;
        //todo: display loading indicator
        [[CPUserCacheProvider _] loginWithSuccess:^{
            [self showHideAuthButtons];
            [self updateNameAndAvatar];
        } andFailure:^{
            UIAlertView *failWhale = [[UIAlertView alloc] initWithTitle:@"Twitter Login Failed!" message:@"There was a problem with logging in with Twitter." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
            [failWhale show];
        }];

        NSLog(@"CPSettingsViewController.twitterAuthButtonPressed: Twitter User Logged in %@", appUser.username);
        [[NSNotificationCenter defaultCenter] postNotificationName:userAuthChangedNotification object:nil];
    }];

}

我有一个个人Twitter帐户和一个用于测试的帐户。我第一次登录时,使用我的个人帐户登录。我想用我的测试帐户登录。但每次我登录时,该应用程序都会自动使用我的个人帐户登录。我甚至删除了相应的PFUser(通过Parse的仪表板),应用程序仍然会自动使用我的个人帐户登录。

我如何让应用程序让我再次询问我的Twitter凭据?我想知道在iOS设置中是否可以做些什么来让应用程序忘记我的个人Twitter帐户。

1 个答案:

答案 0 :(得分:0)

尝试使用[PFUser logout]这是将用户注销的方法。当您调用登录时,用户将在本地缓存,因此您需要通过注销来销毁该用户。

相关问题