A peer-to-peer network between a group of devices that are connected to Game Center.
- iOS 4.1+
- macOS 10.8+
- tvOS 9.0+
Matches provide transmittal of both voice and game data. Your game never directly allocates
GKMatch objects. Instead, it uses the
GKMatchmaker class to programmatically find a match with other interested players or a
GKMatchmaker object to display a user interface to the player.
After your game receives a match object, set its delegate and then wait until the other participants are connected to the match. You can read the
expected property to determine how many players have not connected to the match.
Each device in the match is identified by the player identifier for the player authenticated on that device. Your game transmits its own data to other players by calling either the
send method or the
send(_: method. To allow voice chat, call
voice to create one or more voice channels.
When you are finished with the match, call the match’s
disconnect() method. Before you release your last reference to a
GKMatch object, make sure you set the delegate back to
nil. Otherwise a match you thought was long gone can suddenly call
match(_: when you are in the middle of the next game.