无法分配 GKTurnBasedMatchOutcome

GKTurnBasedMatchOutcome cannot be assigned

我正在 Swift 中制作基于回合的 iOS 游戏,在调用 endMatchInTurnWithMatchData 方法之前,我需要设置 matchOutcome 属性 每个参与者。但是函数中的第一行代码(如下)导致错误 Cannot assign a value of type 'GKTurnBasedMatchOutcome' to a value of type 'GKTurnBasedMatchOutcome!'

func endGame()
{
    self.currentMatch.participants[0].matchOutcome = GKTurnBasedMatchOutcome.Won
    self.currentMatch.endMatchInTurnWithMatchData(gameData, completionHandler: {(error) -> Void in gameData = NSData()})
}

首先尝试将参与者从参与者数组中拉出,如下所示:

GKTurnBasedParticipant *part0 = match.participants[0];
part0.matchOutcome = GKTurnBasedMatchOutcomeWon;