views:

86

answers:

1

I am developing an iPad app (the "Server") which needs to communicate with up to 4 iPhone/iPod Touches (the Clients). Should I create 4 GKSessions for each of the iPhones? Should I have 1 GKSession which connects all 5 devices, and if I do, will each iPhone be able to "see" the others (Ideally, this shouldn't happen as it will keep things simple)? The apps will together be a bit like the Scrabble app for iPad (not in functionality, but in idea).

Does anyone have any gamekit sample code or good links?

I downloaded GKTank and I cannot get the iPad and iPhone to complete their connection. I even turned off wifi on both but they get stuck at waiting to connect.

A: 

i recently implemented something like this. I used this as a base and this as a good reference.

in my ipad viewcontroller i have a button that sets up the session

session = [[GKSession alloc] initWithSessionID:@"mySessionId" displayName:[[UIDevice currentDevice] name] sessionMode:GKSessionModeServer];
session.delegate = self;
[session setDataReceiveHandler: self withContext:nil];
session.available = YES;

for when you are ready for clients to connect. in the iphone remote viewcontroller i use the GKPeerPickerControllerDelegate and create a peer session when it finds your server.

for me, walking throught the first guide helped me get connected, and the reference material helped me understand what all was going on.

in your server, you then have your list of peers (like the the objectgraph example) that you can send messages individually to a peer, or to all peers from the server.

AtomRiot
I can't wait to work on what you've mentioned. Too busy at the moment, but thanks a ton.
Bryan