私はFacebookのログインの問題に苦しんでいます。昨日のFacebookのログインは正しく動作していますが、今日は私のアプリを起動すると動作しません。なぜか、なぜ突然動作していないのですか? Facebookのログインに関連するものは、すべてが設定されているコンソールを開発する あなたが考えているなら私を助けてください。私は既にキーチェーンの共有も有効にしています。 FacebookログインのためのIOS SDKでログインできません
コード
@IBAction func onClickFacebookLoginAction(_ sender: Any) {
var message = String()
if Reachability.isConnectedToNetwork() == true{
let loginView:FBSDKLoginManager = FBSDKLoginManager()
loginView.loginBehavior = FBSDKLoginBehavior.web
loginView.logIn(withReadPermissions: ["email","public_profile","user_friends"], from: self, handler: { (result, error) in
if(error != nil){
print("Error while try to login with facebook-\(error?.localizedDescription)")
}else if (result?.isCancelled)!{
print("User cancel the facebook login")
}else{
if result?.grantedPermissions != nil{
if (result?.grantedPermissions .contains("email"))!{
self.ShowProgressHUD()
self.fetchUserInfo()
}else{
message = message.appending("Facebook email permission error")
self.showAlertMessage(message: message, title: "")
}
}
}
})
}
}
func fetchUserInfo() -> Void {
if (FBSDKAccessToken.current() != nil) {
let graphRequest:FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "/me", parameters:["fields": "id, first_name, last_name, name, email, picture"])
graphRequest.start(completionHandler: { (connection, result, error) in
if(error != nil){
self.showAlertMessage(message: (error?.localizedDescription)!, title: "")
}
else
{
print("Result is:\(result)")
self.dictionary = result as! [String : AnyObject]
let name = self.dictionary["name"] as!String
let email = self.dictionary["email"] as! String
let token = FBSDKAccessToken.current().tokenString
print("name is -\(name)")
print("email is -\(email)")
print("token is -\(token)")
DispatchQueue.main.async {
let SelectionViewObj = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
self.navigationController?.pushViewController(SelectionViewObj, animated: true)
}
}
})
}
}
'/' graphPathパラメータ値の前に 'graphPathがある理由:「/私」' –
@PraveenKumarは、私はちょうどいくつかのチュートリアルと同じことをやってチュートリアルに従ってください。 –
スラッシュを削除して試してみてください。 https://developers.facebook.com/docs/ios/graphの詳細を確認してください。https://stackoverflow.com/questions/31383578/ios-facebooksdk-get-user-full-details –