I’m using gamekit for bluetooth file transfer. It is working perfectly in first view. Once the connection is established I want to continue the same session in next view. How to do this?
EDIT:
I have taken GKSession object in AppDelegate so that I can use this throughout my application, but I am unable to get that session for more than 1 class in which delegate picker. I want to use app.currentSession in next page so that data exchange can continue in next class as well.
Code:
-(IBAction) Connect:(id)sender{
picker = [[GKPeerPickerController alloc]init];
picker.delegate = self;
picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
[btnConnect setHidden:YES];
[btnDisconnect setHidden:NO];
[picker show];
}
- (void)peerPickerController:(GKPeerPickerController *)picker1 didConnectPeer:(NSString *)peerID toSession:(GKSession *) session{
app.currentSession = session;
session.delegate = self;
[session setDataReceiveHandler:self withContext:nil];
picker.delegate = nil;
[picker dismiss];
[picker autorelease];
}
Without seeing your code, there could be many many reasons for this. However, I assume that you are creating your GKSession in some method in your view. I would suggest that this is not the correct place and you need to revisit your application design.