簡體   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