获得玩家别名

时间:2012-06-15 15:24:35

标签: objective-c ios gamekit

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

谢谢!

1 个答案:

答案 0 :(得分: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
}


}];