简体   繁体   中英

redirection of iOS app to a specific view controller or url after successful Facebook login

I have made an iOS app that has a Facebook integration to authenticate the user to get into app. But in my case, after successful login ,the control goes back to login with Facebook page (view controller) rather than get into my app home page (view controller). but i solve this by using below method

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

In login viewcontroller and it takes me on home page (view controller) but after viewing the login page for a second and i didn't want to show login page.and also on my home page, i want that when i click on logout button it takes me on login page but this is not working even performing segue like this:

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

[self performSegueWithIdentifier:@"back_authentication" sender:self]; 
}

For your knowledge, I am using storyboard and plain view controller files rather than navigation controller and my app is not uploaded on app store yet, it is in a development phase right now.

It sounds like you are not using a navigation controller at all but you will need one in order to perform these pushes even with segues. Whatever your root view controller is in your storyboard, select that view controller and in the top menu of Xcode click:

Editor > Embed In > Navigation Controller

This will add a navigation controller to your storyboard and manage the pushing of views.

Its too late I know, just thought you to provide an answer to this:

func controllingNavigationAfterLogin(){
    let vcPage = self.storyboard?.instantiateViewControllerWithIdentifier("YourViewControllerStoryboardID") as! YourViewControllerClassName
    let vcPageNav = UINavigationController(rootViewController: vcPage)
    let appDel = UIApplication.sharedApplication().delegate as! AppDelegate
    appDelegate.window?.rootViewController = vcPageNav
}

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