Reputation: 21
In ios gamekit framework, what is the code to identify the names of the devices that are connected together?
Upvotes: 1
Views: 529
Reputation: 57179
With your GKSession you can get all peers with a specified state then get their name.
//Get all connected peers
NSArray *peerIds = [gksession peersWithConnectionState: GKPeerStateConnected];
for(NSString *peerId in peerIds)
{
//Log the peer name
NSLog(@"%@", [gksession displayNameForPeer:peerID]);
}
Upvotes: 2