Game Development Reference
If you followed the leaderboard and achievement view examples, you know that each
required the GameKitHelper class to implement a protocol, and with matchmaking
it's no different. I also added GKMatchDelegate because you're going to need it
@interface GameKitHelper : NSObject < GKLeaderboardViewControllerDelegate,←
GKAchievementViewControllerDelegate, GKMatchmakerViewControllerDelegate, ←
The GKMatchmakerViewControllerDelegate protocol requires three meth-
ods to be implemented: one for the player pressing the Cancel button, one for failing
with an error, and one for finding a suitable match. The latter deserves a mention:
if ([delegate respondsToSelector:@selector(onMatchFound:)])
If a match was found, this match is set as the current match, and the delegate's
onMatchFound method is called to inform it about the newly found match.
Instead of hosting a match, you can also instruct Game Center to try to automatically
find a match for you, as shown in Listing 14-21 . If successful, the delegate receives the
same onMatchFound message.
if (isGameCenterAvailable == NO)