Skip to main content

How to get own peerID in a gamekit bluetooth connection?



I know how to get the other players peerID (from the didConnectPeer event or when i receive data) but how can i get the peerid of the iphone itself after a connection has been made?





EDIT





Seems to be wrong though. The peerID from didpeerPickerController:didConnectPeer:toSession: seems to be the peer you connected TO. I did this check:







-(void)peerPickerController:(GKPeerPickerController *)picker didConnectPeer:(NSString *)peerID toSession:(GKSession *)session

{

CCLOG(@"I am %@", peerID);

[picker dismiss];

picker.delegate = nil;

picker autorelease];

}

-(void)receiveData:(NSData *)data fromPeer:(NSString *)peer inSession:(GKSession*)session context:(void *)context

{

CCLOG(@"Received from %@", peer);

}









2012-02-05 21:06:18.093 x[2546:707] I am 77606856





2012-02-05 21:06:19.154 x[2546:707] Received from 77606856







And i would get the same id on both printouts when sending something from the other iphonedevice. Did i maybe missunderstand you?


Comments

  1. If I understand your question correctly, what you're looking for is the peerId property on the GKSession passed to you by the peerPickerController:didConnectPeer:toSession:. delegate method.

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?