解析iOS SDK PFLoginViewController Facebook Segue

时间:2014-12-04 12:36:37

标签: ios facebook parse-platform pfloginviewcontroller

我使用PFLoginViewController登录Facebook时遇到问题。 我使用最新的Parse SDK。在Xcode 6.1.1上运行。使用Interface Builder和Storyboard。

我的项目使用TabBarViewController作为默认ViewController,在登录和注册后,用户应该定向到此TabBarViewController。我可以使用“登录和注册”选项实现[self performSegueWithIdentifier...],但不能在使用Facebook按钮时实现。

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

中输入了AppDelegate.m

我怀疑在代码中要改变什么以及在哪里配置Facebook登录以执行主要TabBarController的segue?是否存在与视图层次结构和rootViewController等设置相关的任何内容......?

Thnx和欢呼

1 个答案:

答案 0 :(得分: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];
}
}