繁体   English   中英

登录后的Facebook IOS SDK

[英]Facebook IOS sdk after login

我的IOS应用程序中有一个Facebook登录名。 登录后可以显示另一个视图控制器吗?

这是ViewController.h中的代码

#import "ViewController.h"
#import "dashBoardViewController.h"

@interface ViewController ()



@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    self.loginButton.delegate = self;
    self.loginButton.readPermissions = @[@"public_profile", @"email"];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}





- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
                            user:(id<FBGraphUser>)user {
    [self performSegueWithIdentifier:@"yourSegueToDestinationViewController" sender:self];
}


-(void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView{


}


-(void)loginView:(FBLoginView *)loginView handleError:(NSError *)error{
    NSLog(@"%@", [error localizedDescription]);
}


@end

我尝试了一些代码并从Web上进行了回答,但是登录后它显示了带有蓝色Facebook按钮“注销”的同一页面,我只需要进入另一个视图并传递FacebookID和Facebook用户名即可。 那可能吗? 错误在哪里?

编辑我将我的方法更改为此:

- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView
                            user:(id<FBGraphUser>)user {
    [self.navigationController presentViewController:dashBoardViewController animated:YES completion:nil];
}

并在我的ViewController.hi中添加:

@property (weak, nonatomic) IBOutlet ViewController *dashBoardViewController;

说我要改变

   [self.navigationController presentViewController:dashBoardViewController animated:YES completion:nil];

   [self.navigationController presentViewController:_dashBoardViewController animated:YES completion:nil];

当我这样做时,结果是一样的

是的,有可能。

[self.navigationController pushViewController:YourViewController animated:YES];

要么

[self.navigationController presentViewController:YourViewController animated:YES completion:nil];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM