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



我有一个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];
}];
}

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

我如何让应用程序让我再次请求我的Twitter凭据?我想知道我是否可以在iOS设置中做些什么,让应用程序忘记我的个人推特账户。

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

最新更新