<!--
{
  "availability" : [
    "iOS: 8.0.0 - 17.0.0",
    "iPadOS: 8.0.0 - 17.0.0",
    "macCatalyst: 13.1.0 - 17.0.0",
    "macOS: 10.10.0 - 14.0.0",
    "tvOS: 9.0.0 - 17.0.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKAchievement/challengeComposeController(withMessage:players:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKAchievement(im)challengeComposeControllerWithMessage:players:completionHandler:"
  },
  "title" : "challengeComposeController(withMessage:players:completionHandler:)"
}
-->

# challengeComposeController(withMessage:players:completionHandler:)

Provides a view controller that you present to the player to issue an achievement challenge.

```
func challengeComposeController(withMessage message: String?, players: [GKPlayer], completionHandler: GKChallengeComposeCompletionBlock? = nil) -> NSViewController
```

## Parameters

`message`

The challenge message which the player can edit before GameKit sends it to other players.

`players`

The players that the challenge should be sent to.

`completionHandler`

A block that GameKit calls after it displays the view controller.

## Return Value

A view controller that contains the player identifiers and the challenge message.

## Discussion

This method presents the view controller modally from the top view controller. GameKit calls the completion handler block after it displays the view controller and the player sends or cancels the challenge.

---

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)