0
votes

I want to see in the menu of my game in which matches I'm currently participating. All games in my match have 2 players, you and your opponent. I don't get it done by the developer guide.

I have an array for all the matches that I'm currently in this loads when my player gets authenticated with game center:

[GKTurnBasedMatch loadMatchesWithCompletionHandler:^(NSArray *matches, NSError *error) {
    if (matches) {         
        thisMatch = matches[0];
    }
}

How would I get for example the opponent name of matches[0] and whose turn it is in that game, you or the other one?

1

1 Answers

0
votes

thisMatch.currentParticipant would give you the GKTurnBasedParticipant whose turn is next. To get the opponent's name, iterate over the thisMatch.participants and find the one whose playerID is not equal to your ID.