title: iOS CoreBluetooth:Sending data from central and getting response from peripheral
body: <p>I am developing a Bluetooth app. I have connected to the bluetooth device and found the services and characteristics in it. I am facing problem in sending write request from central and receiving response from peripheral. I have written code as below to write data. How will I know that peripheral received that data? Can I show any alert in peripheral. And, in the same way, I want to receive the data from the peripheral so that the central should show an alert that it has got response from peripheral.</p>
  
  <p>Here is the below code I have written </p>
  
  <pre><code>  - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:  
    (CBService *)service error:(NSError *)error {
     if (!error) {
      printf("Characteristics of service with UUID : %s found\r\n",[self   
     CBUUIDToString:service.UUID]);
      for(int i=0; i &lt; service.characteristics.count; i++) {
          CBCharacteristic *c = [service.characteristics objectAtIndex:i];
          printf("Found characteristic %s\r\n",[ self CBUUIDToString:c.UUID]);
          CBService *s = [peripheral.services objectAtIndex:(peripheral.services.count - 1)];
          if([self compareCBUUID:service.UUID UUID2:s.UUID])
          {
              printf("Finished discovering characteristics");
  
              break;
          }
       }
  
    }
     else {
      printf("Characteristic discorvery unsuccessfull !\r\n");
    }
  
    }
  </code></pre>
  
  <p>for writing the value </p>
  
  <pre><code>- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:  
     (CBCharacteristic *)characteristic error:(NSError *)error
    {
      NSString *payloadMessage = @"Hello";
      NSData *payload = [payloadMessage dataUsingEncoding:NSUTF8StringEncoding];
      [peripheral writeValue:payload forCharacteristic:characteristic    
     type:CBCharacteristicWriteWithResponse];
  
   }
  </code></pre>
  
  <p>and i need to get the version of the ble device i.e GET_VERSION = 0x4a;
  please help me regarding this or else provide any examples for writing and reading data from the both devices.Thanks in advance</p>