2

I bought this book and got its source code from: http://apress.com/book/downloadfile/4652

You can also download the source code without buying. I took the GameKitHelper class form it and included it in my game as I am trying to add game center multiplayer.

I am now trying to send and receive data but it crashes when I run it. Using that class, I call the send/receive data by using:

GameKitHelper *gkHelper = [GameKitHelper sharedGameKitHelper];

send:

[gkHelper sendDataToAllPlayers:(void *)data length:(NSUInteger)length];

Receive:

[gkHelper match:(GKMatch *)match didReceiveData:(NSData *)data fromPlayer:(NSString *)playerID];

But what variables to I enter? What match? gkHelper.currentMatch? The only data I want to send is an integer, the score, I also want to receive this, so each player sees one another scores. Do I need to make this integer into an NSData value? What playerID?

If someone could shed some light I would appreciate it, thanks.

Josh Kahane
  • 16,765
  • 45
  • 140
  • 253

0 Answers0