Get email and name Facebook SDK v4.4.0 Swift

前端 未结 10 2136
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-08 02:22

TL;TR: How do I get the email and name of a user that is logged in on my app using the facebook SDK 4.4

So far I have managed to get login working, now I can get the

10条回答
  •  佛祖请我去吃肉
    2020-12-08 02:33

    let request = GraphRequest.init(graphPath: "me", parameters: ["fields":"first_name,last_name,email, picture.type(large)"], accessToken: AccessToken.current, httpMethod: .GET, apiVersion: FacebookCore.GraphAPIVersion.defaultVersion)
    
    request.start({ (response, requestResult) in
          switch requestResult{
              case .success(let response):
                 print(response.dictionaryValue)
              case .failed(let error):
                 print(error.localizedDescription)
          }
    })
    

提交回复
热议问题