开发者

acceptConnectionFromPeer generates EXC_BAD_ACCESS

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:peerI开发者_如何学PythonD];

in the same place works fine

If anyone has an ideea what's wrong please let me know.


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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜