成功登录Facebook后如何导航欲望视图控制器?

时间:2017-09-09 11:09:49

标签: objective-c

- (void)viewDidLoad {
[super viewDidLoad];
FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];

loginButton.center = self.view.center;
[self.view addSubview:loginButton];

if ([FBSDKAccessToken currentAccessToken]) {
    NSLog(@"the user is lopgged in ");
    UIStoryboard *mainStoryboard =[UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"secondid"];
    [self presentViewController:vc animated:YES completion:nil];
    FBSDKLoginButton *loginButton = [[FBSDKLoginButton alloc] init];
    // Optional: Place the button in the center of your view.
    loginButton.center = self.view.center;
    [self.view addSubview:loginButton];


}}

我使用上面的代码进行Facebook登录这里Facebook登录工作正常,但我想在Facebook成功登录后导航欲望视图控制器但是上面的代码导航到同一页面,但是当我在第二次运行时时间它将导航到另一个视图控制器,但在第一次它将返回到主视图控制器。例如,我必须在一个视图控制器中登录Facebook并且必须在另一个视图控制器上注销。

1 个答案:

答案 0 :(得分:0)

nvarchar(Max)

[self dismissViewControllerAnimated:YES completion:^ {

UIViewController *presentViewController = self.presentingViewController;

}];