<!--
{
  "availability" : [
    "iOS: 4.1.0 - 7.0.0",
    "iPadOS: 4.1.0 - 7.0.0",
    "macOS: 10.8.0 - 10.10.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKMatchmaker/inviteHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKMatchmaker(py)inviteHandler"
  },
  "title" : "inviteHandler"
}
-->

# inviteHandler

A block that GameKit calls when an invitation to join a match is accepted by the local player.

```
var inviteHandler: ((GKInvite, [Any]?) -> Void)? { get set }
```

## Discussion

The block takes the following parameters:

- *acceptedInvite*: The invitation accepted by the player.
- *playerIDsToInvite*: An array of `NSString` objects containing player identifiers for additional players to invite into the game.

Your block needs to respond to the invitation in one of two ways:

- Display the standard user interface by initializing a new [`GKMatchmakerViewController`](/documentation/GameKit/GKMatchmakerViewController) object, passing the invitation object and the list of player identifiers as parameters.
- Create a match programmatically by calling the [`match(for:completionHandler:)`](/documentation/GameKit/GKMatchmaker/match(for:completionHandler:)) method on the shared matchmaker instance.

If your game receives an invitation while it’s running, it needs to transition to multiplayer play. It must clean up any existing content, such as ending the current match the player is playing, and then process the invitation.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)