我在我的应用程序中使用 facebook sdk。我用facebook简单地登录了,如下所示:
FBLoginView *loginview = [[FBLoginView alloc] initWithPermissions:[NSArray arrayWithObject:@"publish_actions"]];
UIImage *loginImage = [UIImage imageNamed:@"login_facebook_button.png"];
// loginview.backgroundColor = [UIColor redColor];
loginview.frame = CGRectMake(15, 294, loginImage.size.width, loginImage.size.height);
for (id obj in loginview.subviews)
{
if ([obj isKindOfClass:[UIButton class]])
{
UIButton * loginButton = obj;
[loginButton setBackgroundImage:loginImage forState:UIControlStateNormal];
[loginButton setBackgroundImage:nil forState:UIControlStateSelected];
[loginButton setBackgroundImage:nil forState:UIControlStateHighlighted];
[loginButton sizeToFit];
}
if ([obj isKindOfClass:[UILabel class]])
{
UILabel * loginLabel = obj;
loginLabel.text = [Lang get:@"SIGN_IN_WITH_FACEBOOK"];
loginLabel.textAlignment = UITextAlignmentCenter;
[loginLabel setTextColor:[UIColor colorWithRed:228.0/255.0 green:228.0/255.0 blue:228.0/255.0 alpha:1.0]];
[loginLabel setShadowColor:[UIColor colorWithRed:127.0/255.0 green:127.0/255.0 blue:127.0/255.0 alpha:1.0]];
loginLabel.frame = CGRectMake(0, 0, loginImage.size.width, loginImage.size.height);
}
}
loginview.delegate = self;
[self.view addSubview:loginview];
我已经正常登录了。但是当我尝试使用它注销时
[FBSession.activeSession closeAndClearTokenInformation];
我得到了异常,它没有写出真正的错误。此时我的应用程序崩溃了。
但是它实际上清除了令牌,因为崩溃后它已经注销。
那么我做错了什么?
谢谢