我无法让消息上的 summaryText 始终显示与向前传递的 UUID 关联的名称。当它无法工作时,只会在其位置显示一个空字符串。
let local = activeConversation!.localParticipantIdentifier
let remote = activeConversation!.selectedMessage!.senderParticipantIdentifier
if winningPlayer.id == localPlayer!.id {
layout.subcaption = "$\(local) wins!"
message.summaryText = "$\(local) won \(scoreForLocalPlayer()) - \(scoreForRemotePlayer())"
}
else {
layout.subcaption = "$\(remote) wins!"
message.summaryText = "$\(remote) won \(scoreForRemotePlayer()) - \(scoreForLocalPlayer())"
}
这里特别奇怪的是 layout.subcaption总是显示正确的名称,但 message.summaryText 通常只显示“ won 1 - 0”,而不是预期的“(Winning Player's Name) won 1 - 0”