josephhaggerty
josephhaggerty

Reputation: 21

GameKit Device Identification

In ios gamekit framework, what is the code to identify the names of the devices that are connected together?

Upvotes: 1

Views: 529

Answers (1)

Joe
Joe

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

Related Questions