Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PFLoginViewController not showing Facebook login button with Swift

Here is my Swift code:

        let loginViewController = PFLogInViewController()
        loginViewController.delegate = self;
        loginViewController.signUpController.delegate = self;
        loginViewController.fields = PFLogInFields.Facebook
        self.presentViewController(loginViewController, animated: animated, completion: nil)

I have tried everything possible, but don't know why it is not showing the Facebook login button. It just shows the default fields.

like image 391
Namit Gupta Avatar asked Dec 05 '25 09:12

Namit Gupta


1 Answers

Check again:

  1. if you have in appdelegate [PFFacebookUtils initializeFacebook]
  2. you have to add, also PFLogInFieldsDismissButton
  3. you must also set the facebookPermissions property to the a list of the permissions we want to be granted by the user

Example for ObjC

if (![PFUser currentUser]) {        
        // Customize the Log In View Controller
        PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
        [logInViewController setDelegate:self];
        [logInViewController setFacebookPermissions:[NSArray arrayWithObjects:@"friends_about_me", nil]];
        [logInViewController setFields: PFLogInFieldsFacebook | PFLogInFieldsDismissButton];

        // Present Log In View Controller
        [self presentViewController:logInViewController animated:YES completion:NULL];
    }
like image 165
TonyMkenu Avatar answered Dec 07 '25 23:12

TonyMkenu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!