I want to establish a bluetooth connection between 2 iPhones with a GKSession without GKPeerPickerController and without pushing any "connect button" on both sides.
I'm using the following code:
currentSessionAuto = [[GKSession alloc] initWithSessionID: @"instant-friend-auto"
currentSessionAuto.delegate = self;
currentSessionAuto.available = YES;
currentSessionAuto.disconnectTimeout = 5;
[currentSessionAuto setDataReceiveHandler: self withContext:nil];
When the application is starting on both sides, the - (void)session:(GKSession *)session peer:(NSString *)peerID didChangeState:(GKPeerConnectionState)state is called on both sides with the state "GKPeerStateAvailable".
With a "classic" app, a popup is displayed on both side to ask for connection and most of the time, both "users" does not click on the connect button on the same time.
If I want to have an "Automatic connection" I need a mechanism to only initiate the session on 1 side, because without this mechanism two sessions will be initiated and errors occur.
Any idea / help ?