ios - Get facebook profile picture URL -
ios - Get facebook profile picture URL -
i logged user app using facebook sdk, how can url profile picture? far have:
func loginviewfetcheduserinfo(loginview : fbloginview!, user: fbgraphuser) { activityindicator.startanimating() println("user: \(user)") println("user id: \(user.objectid)") println("user name: \(user.name)") var useremail = user.objectforkey("email") string println("user email: \(useremail)") }
i tried println( user.objectforkey("picture") string)
doesnt seem work.
you can generate url long have users facebook id. using user.objectid
code:
let avatarlocation = "https://graph.facebook.com/\(user.objectid)/picture"
that give little variant of users avatar. can specify size, , they'll seek , match size request.
let avatarlocation = "https://graph.facebook.com/\(user.objectid)/picture?width=640&height=640"
both strings above. they'll need used create nsurl if want retrieve them.
ios facebook swift
Comments
Post a Comment