我有这个Game Center功能用于查找玩家。最近我下载了Xcode 6.3 - beta 3。
这是功能:
func lookupPlayers() {
let playerIDs = match.players.map { ($0 as! GKPlayer).playerID }
GKPlayer.loadPlayersForIdentifiers(playerIDs) { (players, error) -> Void in
if error != nil {
println("Error retrieving player info: \(error.localizedDescription)")
self.matchStarted = false
self.delegate?.matchEnded()
} else {
for player in players {
println("Found player: \(player.alias)")
self.playersDict[player.playerID] = player //use player
}
self.matchStarted = true
GKMatchmaker.sharedMatchmaker().finishMatchmakingForMatch(self.match)
self.delegate?.matchStarted()
}
}
}
Xcode现在标记了一条警告说"播放器ID在IOS 8中已被弃用:使用播放器"
有人可以帮我修改代码以删除警告。我不明白需要改变什么。
答案 0 :(得分:3)
尝试这样做,似乎GKPlayer未正确注册
for player in players as! [GKPlayer]
{
println("Found player: \(player.alias)")
self.playersDict[player.playerID] = player //use player
}