---
title: "findPlayers(forHostedMatchRequest:withCompletionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkmatchmaker/findplayers(forhostedmatchrequest:withcompletionhandler:)"
---

# findPlayers(forHostedMatchRequest:withCompletionHandler:)

Initiates a request to find players for a hosted match.

## Declaration

```swift
func findPlayers(forHostedMatchRequest request: GKMatchRequest, withCompletionHandler completionHandler: (@Sendable ([String]?, (any Error)?) -> Void)? = nil)
```

```swift
func findPlayers(forHostedMatchRequest request: GKMatchRequest) async throws -> [String]
```

## Parameters

- `request`: The configuration for the desired match.
- `completionHandler`: A block to call when GameKit creates the match. This block receives the following parameters:

## Discussion

Discussion When GameKit calls this completion handler, your game needs to connect those players to your own server. On iOS 6, if the match request’s playersToInvite property is non-NIL, Game Center only sends invitations out to the players listed in the property. If the playersToInvite property is NIL, Game Center then searches for any waiting players that match the request. Prior to iOS 6, GameKit ignores the match request’s playersToInvite property and this method only searches for available players.

## See Also

### Related Documentation

- [cancel()](gamekit/gkmatchmaker/cancel().md)

### Deprecated Methods

- [cancelInvite(toPlayer:)](gamekit/gkmatchmaker/cancelinvite(toplayer:).md)
- [startBrowsingForNearbyPlayers(reachableHandler:)](gamekit/gkmatchmaker/startbrowsingfornearbyplayers(reachablehandler:).md)
