Game Development Reference
GameKitHelper* gkHelper = [GameKitHelper sharedGameKitHelper];
It checks whether the local player is authenticated, and if so, it calls the
getLocalPlayerFriends method of the GameKitHelper class right away.
Take a look at that in Listing 14-7 .
if (isGameCenterAvailable == NO)
GKLocalPlayer* localPlayer = GKLocalPlayer.localPlayer;
^(NSArray* friends, NSError* error)
if ([delegate respondsToSelector:@selector(onFriendListReceived:)])
Because the getLocalPlayerFriends method doesn't know when it's called or
by whom, it plays things safe by checking again that the local player is actually authen-
ticated. Then it calls the GKLocalPlayer class's loadFriendsWithComple-
tionHandler method, for which you'll supply another block object that's run when
the server returns a list of player identifiers as strings. Unsurprisingly, this list of identi-
fiers is stored in the friends array.