<!--
{
  "availability" : [
    "iOS: 4.2.0 - 10.0.0",
    "iPadOS: 4.2.0 - 10.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.8.0 - 10.12.0",
    "visionOS: 1.0.0 - 1.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKFriendRequestComposeViewController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKFriendRequestComposeViewController"
  },
  "title" : "GKFriendRequestComposeViewController"
}
-->

# GKFriendRequestComposeViewController

Your game uses the `GKFriendRequestComposeViewController` class to present a screen that allows the local player to send friend requests to other players.

```
class GKFriendRequestComposeViewController
```

## Overview> Important:
> Your game must initialize a local player before you can use any Game Center classes. If there is no initialized player, your game receives a ``doc://com.apple.gamekit/documentation/GameKit/GKError/Code/notAuthenticated`` error. For more information, see <doc://com.apple.gamekit/documentation/GameKit/authenticating-a-player>.

To show a friend request, initialize a new `GKFriendRequestComposeViewController` object and set the delegate. Optionally, you can customize the request by adding a text message or a list of recipients. Then, present the new view controller and wait for the delegate to be called. Once the delegate is called, dismiss the view controller.

On iOS, you present and dismiss the view controller from another view controller in your game, using the methods provided by the <doc://com.apple.documentation/documentation/UIKit/UIViewController> class. In macOS, you use the [`GKDialogController`](/documentation/GameKit/GKDialogController) class to present and dismiss the view controller. The listing below shows one way your view controller can allow a player to send a request to other players. For this method, an array of [`GKPlayer`](/documentation/GameKit/GKPlayer) objects is passed in as a parameter. The method instantiates a `GKFriendRequestComposeViewController` object, sets its delegate, and adds the list of players intended to receive the invitation. The view controller then presents the friend request and returns.

```objc
- (void) inviteFriends: (NSArray*) players
{
    GKFriendRequestComposeViewController *friendRequestViewController = [[GKFriendRequestComposeViewController alloc] init];
    friendRequestViewController.composeViewDelegate = self;
    if (players.count)
    {
        [friendRequestViewController addRecipientPlayers: players];
    }
    [self presentViewController: friendRequestViewController animated: YES completion:nil];
    [friendRequestViewController release];
}
```

### Subclassing Notes

The [`GKFriendRequestComposeViewController`](/documentation/GameKit/GKFriendRequestComposeViewController) class is not intended to be subclassed.

## Topics

### Determining the Maximum Number of Recipients

[`+  maxNumberOfRecipients`](/documentation/GameKit/GKFriendRequestComposeViewController/maxNumberOfRecipients())

Returns the maximum number of recipients permitted in a single request.

### Delegate

[`composeViewDelegate`](/documentation/GameKit/GKFriendRequestComposeViewController/composeViewDelegate)

The view controller’s delegate

### Adding Recipients

[`-  addRecipientsWithEmailAddresses:`](/documentation/GameKit/GKFriendRequestComposeViewController/addRecipients(withEmailAddresses:))

Adds recipients based on their email addresses.

[`-  addRecipientPlayers:`](/documentation/GameKit/GKFriendRequestComposeViewController/addRecipientPlayers(_:))

Adds recipients based on their Game Center player identifiers.

[`-  addRecipientsWithPlayerIDs:`](/documentation/GameKit/GKFriendRequestComposeViewController/addRecipients(withPlayerIDs:))

Adds recipients based on their Game Center player identifiers.

### Setting an Invitation Message

[`-  setMessage:`](/documentation/GameKit/GKFriendRequestComposeViewController/setMessage(_:))

Sets the text message included in the friend invitation.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`UIUserActivityRestoring`](/documentation/UIKit/UIUserActivityRestoring)

[`NSUserInterfaceItemIdentification`](/documentation/AppKit/NSUserInterfaceItemIdentification)

[`NSExtensionRequestHandling`](/documentation/Foundation/NSExtensionRequestHandling)

[`NSTouchBarProvider`](/documentation/AppKit/NSTouchBarProvider)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSEditor`](/documentation/AppKit/NSEditor)

[`UITraitChangeObservable-67e94`](/documentation/UIKit/UITraitChangeObservable-67e94)

[`UIResponderStandardEditActions`](/documentation/UIKit/UIResponderStandardEditActions)

[`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

[`UIActivityItemsConfigurationProviding`](/documentation/UIKit/UIActivityItemsConfigurationProviding)

[`UIContentContainer`](/documentation/UIKit/UIContentContainer)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSSeguePerforming`](/documentation/AppKit/NSSeguePerforming)

[`UIAppearanceContainer`](/documentation/UIKit/UIAppearanceContainer)

[`UIPasteConfigurationSupporting`](/documentation/UIKit/UIPasteConfigurationSupporting)

[`UIStateRestoring`](/documentation/UIKit/UIStateRestoring)

[`GKViewController`](/documentation/GameKit/GKViewController)

[`UITraitEnvironment`](/documentation/UIKit/UITraitEnvironment)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSStandardKeyBindingResponding`](/documentation/AppKit/NSStandardKeyBindingResponding)

[`Hashable`](/documentation/Swift/Hashable)

[`NSUserActivityRestoring`](/documentation/AppKit/NSUserActivityRestoring)

### Inherits From

[`NSViewController`](/documentation/AppKit/NSViewController)

[`UINavigationController`](/documentation/UIKit/UINavigationController)

---

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)