Good morning,
I would like to redirect to an another View ( MainViewController
) after the user is logged in using the Facebook login. I tried some code from Stackoverflow and other websites but they are not working in my project. Can you help me with that?
Here is my code from AppDelegate.m
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[FBLoginView class];
return YES;
}
I'm not sure if that's the place where I have to edit in order to make the redirection. I have created a segue called Main
which is the one I'm trying to use to make the redirection but it's still not working.
In my ViewController.h
@implementation aupViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.loginButton.readPermissions = @[@"public_profile", @"email"];
//self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Default.png"]];
}
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
//Here you segue your view controller
[self performSegueWithIdentifier:@"Main" sender:self];
}
@end
Thanks in advance.
See this link https://developers.facebook.com/docs/facebook-login/ios/v2.1
There are FBLoginView delegate methods which is call after login sucessful.
// Logged-in user experience
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
//Here you segue your view controller
[self performSegueWithIdentifier:@"youridentifier" sender:self];
}
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.