Hi
I am trying to implement a P2P application. What I try to do is transfer a custom NSObject class's data between the devices. I am not able to figure out when the "receivedData" method is invoked by GKSession.
Here's what I've done
The usual connection and showing a dialog box with peers
When the app receives a state change for a peer and the state is Connected, I am sending the data to all peers (ideally this should be called when each peer accepts the connection) using NSCoding methods
In receivedData, I am decoding the NSData and getting back the NSObject instance
The problem is the session:peer:didChangeState: method is not getting called on both the devices. It just gets called on the device which tapped the "Connect" button in the PeerPicker alert.
Questions
When is didChangeState called and for whom? Shouldn't it be called for each peer when they are connected?
When is the receivedData: method called and for whom? Is it called to confirm receipt of a message (handshake) or just to transmit the data sent by other peers?
Thanks for any help.