---
title: "matchmakerViewController(_:didFailWithError:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkmatchmakerviewcontrollerdelegate/matchmakerviewcontroller(_:didfailwitherror:)"
---

# matchmakerViewController(_:didFailWithError:)

Handles when a view controller encounters an error while finding players for a match.

## Declaration

```swift
func matchmakerViewController(_ viewController: GKMatchmakerViewController, didFailWithError error: any Error)
```

## Parameters

- `viewController`: The view controller that encounters an error.
- `error`: The error that occurs.

## Mentioned in

Finding multiple players for a game Finding players for custom server-based games

## Discussion

Discussion This method needs to dismiss the view controller.

## See Also

### Handling cancellations and errors

- [matchmakerViewControllerWasCancelled(_:)](gamekit/gkmatchmakerviewcontrollerdelegate/matchmakerviewcontrollerwascancelled(_:).md)
