<!--
{
  "availability" : [
    "iOS: 8.0.0 - 10.0.0",
    "iPadOS: 8.0.0 - 10.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.10.0 - 10.11.0",
    "tvOS: 9.0.0 - 10.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 3.0.0 - 3.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKLocalPlayer/loadFriendPlayers(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKLocalPlayer(im)loadFriendPlayersWithCompletionHandler:"
  },
  "title" : "loadFriendPlayers(completionHandler:)"
}
-->

# loadFriendPlayers(completionHandler:)

Retrieves a list of player identifiers for the local player’s friends.

```
func loadFriendPlayers(completionHandler: (@Sendable ([GKPlayer]?, (any Error)?) -> Void)? = nil)
```

## Parameters

`completionHandler`

A block to call when the request completes.

    The block receives the following parameters:

- friendPlayers: An array of [`GKPlayer`](/documentation/GameKit/GKPlayer) objects containing the player identifiers for the players who are friends of the local player. If an error occurs, this value can be non-`nil`. In that case, the array contains the data that GameKit downloads before the error occurs.
- error: If an error occurs, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is `nil`.

## Discussion

The code below shows an example of how to load a player’s friends. Create your own method to save information about the found players.

```objc
- (void) retrieveFriends
{
   GKLocalPlayer *lp = [GKLocalPlayer localPlayer];
   if (lp.authenticated)
   {
      [lp loadFriendPlayersWithCompletionHandler:^(NSArray *friendPlayers, NSError *error) {
         if (friendPlayers != nil)
         {
            [self loadPlayerData: friendPlayers];
         }
      }];
   }
}
```

---

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)