简体   繁体   中英

Facebook IOS sdk after login

i've got a Facebook login in my IOS application. is possible after login to show another view controller?

here is the code in 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

i tried some code and answer from web, but after i login it shows me the same page with the blue Facebook button "Log Out" i only need to go in another View and passing the FacebookID and the Facebook Username. is that possible? where's the error?

EDIT i changed my method to this :

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

and in my ViewController.hi added :

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

it says me to change

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

TO

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

when i do that it's the same result

Yeah it's possible.

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

or

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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