title: How to send and receive data using gksession?
body: <p>Hello
  I am sending data using gksession.code is given below.Here send data works fine
  and gives message that did data send.But i am not able to receive any data on other
  device.When i debug the code it is not calling and going inside the method
  receive data.Does anyone have any idea about this?What's wrong here or how can i 
  solve the problem?</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
      gs=[manager getgkSession];
      //[cs retain]
      self.title = [manager displayNameForPeer:manager.currentConfPeerID];
      NSLog(@"name of mangager is %@",self.title);
  
  }
  
  
  -(IBAction) btnSend:(id) sender
  {
      //---convert an NSString object to NSData---
      NSData* data;
      NSError *error=nil;
      NSString *str = [NSString stringWithString:txtMessage.text];
      data = [str dataUsingEncoding: NSASCIIStringEncoding];     
      if (gs) 
  
      {
          [self.gs sendDataToAllPeers:data 
                         withDataMode:GKSendDataReliable 
                                error:&amp;error];    
              if (!error) 
          {
              NSLog(@"Did send data");
          } 
          else 
          {
              NSLog(@"Send data failed: %@", [error localizedDescription]);
          }   
      }        
  }
  
  
      - (void) receiveData:(NSData *)data 
                  fromPeer:(NSString *)peer 
                 inSession:(GKSession *)session 
                   context:(void *)context {
  
          //---convert the NSData to NSString---
          NSString* str;
          str = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];    
          NSLog(@"data received is %@",str);
          UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Data received" 
                                                          message:str 
                                                         delegate:self 
                                                cancelButtonTitle:@"OK" 
                                                otherButtonTitles:nil];
          NSLog(@"receive data");
          [alert show];
          [alert release];    
      }
  </code></pre>