[英]No FBSession in Facebook iOS SDK 4.x
There is no more class FBSession
in new Facebook iOS SDK v4.x. 新的Facebook iOS SDK v4.x中没有更多类
FBSession
。 How can I find out whether user is logged in or not now? 如何确定用户是否已登录? Thanks in advance.
提前致谢。
Vincent是对的,检查[FBSDKAccessToken currentAccessToken]以确定用户是否已登录。
To check if the user logged in and if so, navigate to another view: 要检查用户是否已登录,如果是,请导航到另一个视图:
if ([FBSDKAccessToken currentAccessToken]) {
// User is logged in
[self performSelector:@selector(accessGrantedNavigation)
withObject:nil afterDelay:0.0];
}
-(void)accessGrantedNavigation{
[self performSegueWithIdentifier: @"segueLoginFB" sender: self];
}
To log out: (although it doesn't allow to change FB user. I think it is because Safari already takes care of that session and remains the same user.) 要注销:(虽然它不允许更改FB用户。我认为这是因为Safari已经负责该会话并且仍然是同一个用户。)
FBSDKLoginManager *manager = [[FBSDKLoginManager alloc] init];
[manager logOut];
Hope it helps. 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.