Parse for iOS: How to create custom Facebook button?

98 views Asked by At

Instead of using the Facebook-branded login button in the ParseUI LogIn View, I want to implement my own custom button with a different layout.

How to create custom Facebook button, so that the user could log in in background and then return to the app?

The goals is to have on my screen only my logo and the Facebook LogIn button. The logIn process should be managed through Parse.

1

There are 1 answers

0
Tomasz Nazarenko On BEST ANSWER

Here is a solution that I came with at the moment. It seems it is enough to bind such function to a custom login button.

let permissions = ["public_profile"]
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions) {
    (user: PFUser?, error: NSError?) -> Void in
    if (error != nil) {
        print(error?.localizedDescription)
    } else if let user = user {
        if user.isNew {
            print("User signed up and logged in thorugh Facebook!")
        } else {
            print("User logged in through Facebok!")
        }
    } else {
        print("User cancelled the Facbook login.")
    }
}