title: Game Center Send and Receive Data
body: <p>I bought this book and got its source code from:
  <a href="http://apress.com/book/downloadfile/4652" rel="nofollow">http://apress.com/book/downloadfile/4652</a></p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>GameKitHelper *gkHelper = [GameKitHelper sharedGameKitHelper];
  </code></pre>
  
  <p>send:</p>
  
  <pre><code>[gkHelper sendDataToAllPlayers:(void *)data length:(NSUInteger)length];
  </code></pre>
  
  <p>Receive:</p>
  
  <pre><code>[gkHelper match:(GKMatch *)match didReceiveData:(NSData *)data fromPlayer:(NSString *)playerID];
  </code></pre>
  
  <p>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?</p>
  
  <p>If someone could shed some light I would appreciate it, thanks.</p>