Facebook iOS SDK and swift: how get user's profile picture

前端 未结 10 1252
天涯浪人
天涯浪人 2021-01-31 03:51

i have integrated Facebook sdk in Xcode 6 (with swift). During the login i request the public_profile permission:

FBSession.openActiveSessionWithReadPermissions(         


        
10条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 04:31

    The profile picture is in fact public and you can simply by adding the user id to Facebook's designated profile picture url address, ex:

    var userID = user["id"] as NSString     
    var facebookProfileUrl = "http://graph.facebook.com/\(userID)/picture?type=large"
    

    This particular url address should return the "large" version of the user's profile picture, but several more photo options are available in the docs.

提交回复
热议问题