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

前端 未结 10 1251
天涯浪人
天涯浪人 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:50

    Thank you @Lyndsey Scott. For Kingfisher, please add enable request http to .plist file.

    NSAppTransportSecurity
    
        NSAllowsArbitraryLoads
        
        NSExceptionDomains
        
            http://graph.facebook.com
            
                NSExceptionAllowsInsecureHTTPLoads
                
                NSIncludesSubdomains
                
            
        
    
    

    Then set your user's picture profile to ImageView.

    let facebookId = "xxxxxxx"
    let facebookProfile: String = "http://graph.facebook.com/\(facebookId)/picture?type=large"
    let url: URL = URL(string: facebookProfile)!
    myImageView.kf.setImage(with: url)
    

提交回复
热议问题