0

我在使用 Facebook 登录时遇到问题PFLoginViewController。我使用最新的 Parse SDK。在 Xcode 6.1.1 上运行。使用界面生成器和故事板。

我的项目使用 aTabBarViewController作为默认值ViewController,在登录和注册后,用户应该被定向到这个 TabBarViewController。我可以[self performSegueWithIdentifier...]使用登录和注册选项来实现,但在使用 Facebook 按钮时不行。

我按下 Facebook 按钮,Safari 打开,我输入用户名和密码,网络再次重定向到应用程序,但 Facebook 按钮不会停止加载活动指示器。它不执行对TabBarViewController. 我进入[PFFacebookUtils initializeFacebook]AppDelegate.m

我的疑问是代码中的哪些更改以及在哪里配置 Facebook 登录以对我的 main 执行 segue TabBarController?与视图层次结构等的设置有什么关系rootViewController...?

Thnx 和欢呼

4

1 回答 1

0

无需执行 segue。使用提供的文档解析调用选项卡控制器视图 .m 文件上的注册/登录视图控制器。所以基本上把它添加到你的主标签栏控制器视图中,一旦它加载并且没有当前用户,它就会填充登录屏幕,如果有一个有效的用户,它就不会填充,所以需要进行 segueing 或实例化

- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];

if (![PFUser currentUser]) { // No user logged in
    // Create the log in view controller
    PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
    [logInViewController setDelegate:self]; // Set ourselves as the delegate

    // Create the sign up view controller
    PFSignUpViewController *signUpViewController = [[PFSignUpViewController alloc] init];
    [signUpViewController setDelegate:self]; // Set ourselves as the delegate

    // Assign our sign up controller to be displayed from the login controller
    [logInViewController setSignUpController:signUpViewController]; 

    // Present the log in view controller
    [self presentViewController:logInViewController animated:YES completion:NULL];
}
}
于 2014-12-04T12:55:16.963 回答