我在SpriteKit swift编码,直到我收到此错误说," Type' GameScene'不符合协议' GKGameCenterControllerDelegate' &#34 ;.我该怎么办?该错误出现在类GameScene上。 (错误不是我没有结束括号,因为我的结束括号位于下方,我没有显示):
import SpriteKit
import GameKit
import UIKit
import GoogleMobileAds
struct PhysicsCategory {
static let Enemy :UInt32 = 0x1 << 0
static let SmallBall : UInt32 = 0x1 << 1
static let Mainball :UInt32 = 0x1 << 2
}
class GameScene: SKScene, SKPhysicsContactDelegate, GKGameCenterControllerDelegate,GADBannerViewDelegate {
var Mainball = SKSpriteNode(imageNamed: "MainBall")
var redmain = SKSpriteNode(imageNamed: "white")
var greenmain = SKSpriteNode(imageNamed: "white")
var darkred = SKSpriteNode(imageNamed: "white")
var orange = SKSpriteNode(imageNamed: "white")
var yellow = SKSpriteNode(imageNamed: "white")
var lightblue = SKSpriteNode(imageNamed: "white")
var blue = SKSpriteNode(imageNamed: "white")
var purple = SKSpriteNode(imageNamed: "white")
var pink = SKSpriteNode(imageNamed: "white")
var origin = SKSpriteNode(imageNamed: "white")
答案 0 :(得分:0)
答案 1 :(得分:0)
您声明GameScene
符合GKGameCenterControllerDelegate
,但您尚未实施所有必要的方法。
您需要在班级中实施gameCenterViewControllerDidFinish(_:)
。