5

我有一个名为 currentMatch 的 GKTurnBasedMatch,我想知道如何在当前正在玩的玩家之后获取正在玩的玩家的名字。

谢谢!

4

1 回答 1

14
NSMutableArray *playerIDs = [NSMutableArray arrayWithCapacity:match.participants.count];
for (GKTurnBasedParticipant *part in match.participants) {
    if([part.playerID isKindOfClass:[NSString class]]){
        [playerIDs addObject:part.playerID];
    }
}


[GKPlayer loadPlayersForIdentifiers:playerIDs withCompletionHandler:^(NSArray *players, NSError *error) {
    for (GKPlayer *player in players) {

       //get the aliases
}


}];
于 2012-06-27T19:38:29.867 回答