<!--
{
  "availability" : [
    "iOS: 4.1.0 -",
    "iPadOS: 4.1.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKMatchmaker/cancel()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKMatchmaker(im)cancel"
  },
  "title" : "cancel()"
}
-->

# cancel()

Cancels a matchmaking request.

```
func cancel()
```

## Discussion

GameKit sends a [`GKError.Code.cancelled`](/documentation/GameKit/GKError/Code/cancelled) error to the completion handler of either the [`findMatch(for:withCompletionHandler:)`](/documentation/GameKit/GKMatchmaker/findMatch(for:withCompletionHandler:)) or [`findPlayers(forHostedRequest:withCompletionHandler:)`](/documentation/GameKit/GKMatchmaker/findPlayers(forHostedRequest:withCompletionHandler:)) method.

---

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)