如何使用 GameKit 设置默认值 0
How do I make the default value 0 with GameKit
let localPlayerScore = request.localPlayerScore ?? 0
问题是 Swift 期望 0 的类型为 GKScore
。
我收到以下错误:
Cannot convert value of type 'Int' to expected argument type 'GKScore'
let localPlayerScore = request.localPlayerScore.value ?? 0
let localPlayerScore = request.localPlayerScore ?? 0
问题是 Swift 期望 0 的类型为 GKScore
。
我收到以下错误:
Cannot convert value of type 'Int' to expected argument type 'GKScore'
let localPlayerScore = request.localPlayerScore.value ?? 0