В моем приложении используется Facebook. Интегрированный FB с моим приложением. Вход также происходит правильно. Но когда я пытаюсь выйти из системы, он показывает, что выход завершен в fbDidLogout, но при попытке войти в систему снова означает, что он просто показывает страницу входа в систему и регистрируется с ранее введенным именем пользователя и паролем.Выход из системы Facebook
Как мы можем выйти из системы правильно.
Любой может помочь или предложить
Вот мой код
Это Войти Выход Кнопка Действие
- (IBAction)LoginOrLogout
{
// If the user is not connected (logged in) then connect. Otherwise logout.
if (!isConnected)
{
// Set the permissions.
// Without specifying permissions the access to Facebook is imposibble.
permissions = [[NSArray arrayWithObjects:@"read_stream", @"publish_stream", nil] retain];
// Set the Facebook object we declared. We’ll use the declared object from the application
// delegate.
facebook = [[Facebook alloc] initWithAppId:@"329082513817407" andDelegate:self];
[btnPublish setHidden:NO];
[messageTextField setHidden:NO];
[facebook authorize:permissions];
// Change the lblUser label's message.
[lblUser setText:@"Please wait..."];
isConnected = YES;
[self setLoginButtonImage];
}
else
{
[facebook logout:self];
[messageTextField setHidden:YES];
[lblUser setText:@"Tap on the Login to connect to Facebook"];
isConnected = NO;
[self setLoginButtonImage];
}
}
Это другие методы
-(void)fbDidLogin
{
// Save the access token key info.
[self saveAccessTokenKeyInfo];
// Get the user's info.
[facebook requestWithGraphPath:@"me" andDelegate:self];
}
-(void)fbDidNotLogin:(BOOL)cancelled
{
UIAlertView *al = [[UIAlertView alloc] initWithTitle:@"Tonify" message:@"Login cancelled." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[al show];
[self LoginOrLogout];
}
-(void)fbDidLogout
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSLog(@"defaults fbDidLogout ........%@",defaults);
if ([defaults objectForKey:@"FBAccessTokenKey"])
{
[defaults removeObjectForKey:@"FBAccessTokenKey"];
[defaults removeObjectForKey:@"FBExpirationDateKey"];
[defaults synchronize];
}
NSLog(@"defaults fbDidLogout ........%@",defaults);
NSLog(@"logout success!");
// Keep this for testing purposes.
NSLog(@"Logged out Succes");
// Hide the publish button.
[btnPublish setHidden:YES];
}
Спасибо ..... это работает –