Retrieves a list of player identifiers for the local player’s friends.
- iOS 8.0–10.0Deprecated
- macOS 10.10–10.11Deprecated
- Mac Catalyst 13.0–13.0Deprecated
- tvOS 9.0–10.0Deprecated
- watchOS 2.0–3.0Deprecated
A block to be called when the request completes.
The block receives the following parameters:
An array of
GKPlayerobjects containing the player identifiers for the players that are friends of the local player. If an error occurred, this value can be non-
nil. In that case, the array contains the data that Game Kit was able to download before the error occurred.
If an error occurred, this parameter holds an error object that explains the error. Otherwise, the value of this parameter is
Listing 1 shows an example of how to load a player’s friends. Create your own method to save information about the found players.
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.