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?
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