I have a Game Center app. I successfully connect two clients and can send messages etc. I am now trying to add a 3rd/4th client with [GKMatchmaker addPlayersToMatch]
like so...
- (void) findAdditionalPlayer
{
GKMatchRequest *request = [[[GKMatchRequest alloc] init] autorelease];
request.minPlayers = 2; // minPlayers = 3 doesn't work either
request.maxPlayers = 4;
[[GKMatchmaker sharedMatchmaker] addPlayersToMatch:match matchRequest:request completionHandler:^(NSError *error)
{
if (error)
{
// Process the error.
NSLog(@"Could not find additional player - %@", [error localizedDescription]);
}
else
{
NSLog(@"Find additional player expecting = %d", match.expectedPlayerCount);
}
}];
}
If one client (the voted server) calls findAdditionalPlayer
I never connect (the other client is using GKMatchmakerViewController
). Oddly, if both the connected clients call findAddtionalPlayer
, then my completion block executes (the match.expectedPlayerCount == 2)
, but my 3rd client never connects.
Should just one game client call this function above? The documentation doesn't really specify.
Does anyone have an example using addPlayersToMatch
that works?