简体   繁体   中英

Does Parse automatically fetch data from Facebook

The integration between Parse SDK and Facebook SDK on iOS is pretty straightforward and works great but I have to fetch a lot for Facebook and I'm wondering if Parse will automatically fetch these info or do I have to upload them to Parse by myself?

Basically, I sign in/up to the Facebook using:

PFFacebookUtils.logInInBackgroundWithReadPermissions(FacebookSettings.readPermissions) {
    (user: PFUser?, error: NSError?) -> Void in
    if let user = user {
        if user.isNew {
            print("User signed up and logged in through Facebook!")
        } else {
            print("User logged in through Facebook!")
        }
    } else {
        print("Uh oh. The user cancelled the Facebook login.")
    }

    self.performSegueWithIdentifier("MainSegue", sender: nil)
}

And I'm using PFFacebookUtils for this so when I switch to Parse I can see that under User I have info and it was fetched by Parse automatically.

What will happen if I pass a sophisticated array of read permissions eg. with user_actions.fitness , user_education_history etc.? Will Parse automatically fetch those or not?

Nope, Parse does not automatically pull in any data from Facebook outside of authentication data. The read permissions only give you just that, permission to request and read that user's information using the FB Graph API or iOS SDK .

If you want to store or update user information such as their name, profile picture, friends list, and so on, it will be up to you to request this information using FB's API and their ID (automatically saved to authData within User).

You can also look into using FBRequest.requestForMe() to simplify this step.

As for your specific read permissions, you will need to request those permissions before trying to pull in that information. You may want to use PFFacebookUtils.logInWithPermissions for this so you can specify everything in an array that you need access to.

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