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

# challengeComposeController(withPlayers:message:completionHandler:)

Provides a challenge compose view controller with preselected player identifiers and a message.

```
func challengeComposeController(withPlayers playerIDs: [String]?, message: String?, completionHandler: GKChallengeComposeCompletionBlock? = nil) -> UIViewController?
```

## Parameters

`playerIDs`

An array of `NSString` objects that contains the player identifiers that the challenge is to be sent to.

`message`

The message that is sent to other players. This message can be edited by the player.

`completionHandler`

A block to be called after the view controller has been displayed. Contains the reason the handler was called and all player identifiers that the challenge was sent to.

## Return Value

A `UIViewController` view that contains the player identifiers and the challenge message.

## Discussion

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your completion handler. The completion handler is always called on the main thread.

The view controller returned is presented modally from the top view controller. After the view controller is displayed and the player sends or cancels the challenge, the completion handler block is called.

---

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)