Reputation: 1
I try to setup a bluetooth connection between 2 devices (iPhone, iPad..).
Everyting works fine until the client makes a connection request and the host crashes when calling acceptConnectionFromPeer (EXC_BAD_ACCESS)
-(void)session:(GKSession*)session didReceiveConnectionRequestFromPeer:(NSString*)peerID
{
NSError* error=nil;
[m_pSession acceptConnectionFromPeer:peerID error:&error];
}
m_pSession
is valid.. trying to use
NSString* displayName = [m_pSession displayNameForPeer:peerID];
in the same place works fine
If anyone has an ideea what's wrong please let me know.
Upvotes: 0
Views: 245
Reputation: 19867
It looks like the session
that is getting notified of the connection request isn't the same session that referenced by m_pSession
. Trying changing to:
-(void)session:(GKSession*)session didReceiveConnectionRequestFromPeer:(NSString*)peerID
{
NSError* error=nil;
[session acceptConnectionFromPeer:peerID error:&error];
}
Upvotes: 1