Ios 类型';GameViewController';不符合协议';FBSDKLoginButtonDelegate&x27;

Ios 类型';GameViewController';不符合协议';FBSDKLoginButtonDelegate&x27;,ios,swift,facebook,Ios,Swift,Facebook,我正在开发一个移动应用程序,并添加了一个Facebook登录选项。 但是,我有一个错误: 类型“GameViewController”不符合协议“FBSDKloginButtonLegate” 我使用了以下代码: import UIKit import SpriteKit import GameplayKit import FBSDKLoginKit class GameViewController: UIViewController, FBSDKLoginButtonDelegate {

我正在开发一个移动应用程序,并添加了一个Facebook登录选项。 但是,我有一个错误:

类型“GameViewController”不符合协议“FBSDKloginButtonLegate”

我使用了以下代码:

import UIKit
import SpriteKit
import GameplayKit
import FBSDKLoginKit

class GameViewController: UIViewController, FBSDKLoginButtonDelegate {

    override func viewDidLoad() {
        //
    }
}

您应该实现FBSDKLoginButtonDelegate的方法,如下所示:

class GameViewController: UIViewController, FBSDKLoginButtonDelegate {
    func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
        <#code#>
    }

    func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
        <#code#>
    }


    override func viewDidLoad() {
        //
    }
}
class GameViewController:UIViewController、FBSDKloginButtonLegate{
func loginButton(loginButton:FBSDKLoginButton!,didComplete结果:fbsdkloginManager LoginResult!,错误:error!){
}
func loginbuttonidlogout(u loginButton:FBSDKLoginButton!){
}
重写func viewDidLoad(){
//
}
}

要符合协议,您需要覆盖符合协议的viewcontroller或类中的所有非可选方法。