---
title: "challengeComposeController(withMessage:players:completionHandler:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gkachievement/challengecomposecontroller(withmessage:players:completionhandler:)"
---

# challengeComposeController(withMessage:players:completionHandler:)

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

## Declaration

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

```swift
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

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

## Discussion

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.

## See Also

### Issuing Achievement Challenges

- [selectChallengeablePlayers(_:withCompletionHandler:)](gamekit/gkachievement/selectchallengeableplayers(_:withcompletionhandler:).md)
- [challengeComposeController(withMessage:players:completion:)](gamekit/gkachievement/challengecomposecontroller(withmessage:players:completion:).md)
- [GKChallengeComposeHandler](gamekit/gkchallengecomposehandler.md)
- [challengeComposeController(withPlayers:message:completionHandler:)](gamekit/gkachievement/challengecomposecontroller(withplayers:message:completionhandler:).md)
