Creating a New Match Request

To create a new match, you first have to create a new GKMatchRequest object. This object represents the desired parameters for the new match that you will be creating. A GKMatchRequest is used both when presenting a GUI as well as when creating matches programmatically. When working with the GUI, you will pass the GKMatchRequest object to a new instance of GKMatchmakerViewController; on the other hand, if you are handling the matchmaking programmatically, you will pass the object to an instance of GKMatchmaker. See the following sections for more details on programmatic match interaction. For the time being, let's focus on how to create a new match request in your code. Take a look at the following code snippet.

Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.