简体   繁体   中英

Fetching user's info from FB in swift

I have done FB login from my app in Swift 3. Now, I need to fetch profile picture from Facebook. Plzz any one who could give me the solution in Swift 3 ??

Please try this one.

let login = FBSDKLoginManager()

        login.logIn(withReadPermissions: ["email"], from: self) { (result, error) -> Void in

            if (error != nil) {

                self.view.makeToast("Error")
            }
            else if (result?.isCancelled)! {

                self.view.makeToast("Cancel")
            }
            else {

                if (FBSDKAccessToken.current() != nil) {

                    FBSDKGraphRequest(graphPath: "me", parameters: ["fields":"id,interested_in,gender,birthday,email,age_range,name,picture.width(480).height(480)"]).start(completionHandler: { (connection, result, error) -> Void in

                        print(result)
})
                }
            }
        }

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