我可以使用此代码检索所有 Game Center 朋友...
GKLocalPlayer *lp = [GKLocalPlayer localPlayer];
if (lp.authenticated)
{
[lp loadFriendsWithCompletionHandler:^(NSArray *friends, NSError *error)
{
NSLog(@"MY FRIENDS: %@",friends);
if (friends != nil)
{
[GKPlayer loadPlayersForIdentifiers:friends withCompletionHandler:^(NSArray *players, NSError *error)
{
if (error != nil)
{
// Handle the error.
NSLog(@"PLAYERLIST ERROR: %@",[error localizedDescription]);
}
if (players != nil)
{
// Process the array of GKPlayer objects.
NSLog(@"PLAYERS: %@",players);
}
}];
}
}];
}
...但是,有没有办法只检索在线的 GameKit 朋友?