I'm building an application (already on the app store by the way, called MotAMot): a boggle, free app.
This game proposes several playing modes: standalone, multi players using the same iDevice and MULTI in which 2 players play the same gameboard at the same time but each using his own iDevices.
I'm using a GKPeerPickerController instance to manage the connection between the 2 devices.
My only concern is that I can't decide who's iPhone will play the server role and who's the client. When a player sends an invitation to the other, its cool, I can decide that this player will be the server.
Say for instance that player 1 invites player 2 to join the game. But at the same time (or just a few seconds after), player 2 invites player 1 before he gets the invitation popup displayed on his device. My question: how can I be sure that player 1 invited player 2 first (or the opposite)? I mean, of course I got some callbacks because I'm implementing the GKPeerPickerControllerDelegate protocol. But it seems that I get the same messages on both devices, regardless of who really initiates the connection.
// New connection
- (void)peerPickerController:(GKPeerPickerController *)picker
          didConnectPeer:(NSString *)peer
               toSession:(GKSession *)session
{
    // Set the session
    [self setCurrentSession:session];
    // I'm implementing the GKSessionDelegate protocol
    [session setDelegate:self];
// I'll handle any received data from my enemy
    [session setDataReceiveHandler:self withContext:nil];
// I'm cleaning the room
    [myPicker setDelegate:nil];
    [myPicker dismiss];
    [myPicker autorelease];
    myPicker = nil;
}
// A peer changed its state
- (void)session:(GKSession *)session peer:(NSString *)peer didChangeState:    (GKPeerConnectionState)state
{
    switch (state)
    {
        case GKPeerStateConnected:
            [self peerConnected:peer];
            break;
         case GKPeerStateDisconnected:
            // Libération de la session
            [currentSession release];
            currentSession = nil;            
            break;
        case GKPeerStateAvailable:
            break;
        case GKPeerStateConnecting:
             break;
        case GKPeerStateUnavailable:
             break;
    }
}
Would someone have any idea on this?