title: How can I read data from a ble device periodically in ios swift?
body: <p>I am able to read data from ble device in ios(swift). How can I read data periodically from the ble peripheral with a time interval? I tried with NSTimer as in my code below. But I am getting thead1:SIGABRT ERROR in Appdelegate.</p>
  
  <pre><code>func peripheral(peripheral: CBPeripheral, didDiscoverServices error: NSError?) {
      self.statusLabel.text = "Looking at peripheral services"
      for service in peripheral.services! {
  
          let thisService = service as CBService
          if service.UUID == IRTemperatureServiceUUID {
              // Discover characteristics of IR Temperature Service
              peripheral.discoverCharacteristics(nil, forService: thisService)
          }
          // Uncomment to print list of UUIDs
          //println(thisService.UUID)
      }
  }
  
  
  // Enable notification and sensor for each characteristic of valid service
  func peripheral(peripheral: CBPeripheral, didDiscoverCharacteristicsForService service: CBService, error: NSError?) {
  
  
      // update status label
      self.statusLabel.text = "Enabling sensors"
  
      // 0x01 data byte to enable sensor
      var enableValue = 1
      let enablyBytes = NSData(bytes: &amp;enableValue, length: sizeof(UInt8))
  
  
      // check the uuid of each characteristic to find config and data characteristics
      for charateristic in service.characteristics! {
          let thisCharacteristic = charateristic as CBCharacteristic
          // check for data characteristic
  
  
          if thisCharacteristic.UUID == IRTemperatureDataUUID {
              // Enable Sensor Notification
  
           var Say = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: Selector(self.sensorTagPeripheral.readValueForCharacteristic(thisCharacteristic)),userInfo: nil, repeats: true)    //NStimer
  
  
          }
  
  
          // check for config characteristic
          if thisCharacteristic.UUID == IRTemperatureConfigUUID {
              // Enable Sensor
              self.sensorTagPeripheral.writeValue(enablyBytes, forCharacteristic: thisCharacteristic, type: CBCharacteristicWriteType.WithResponse)
          }
      }
  
  }
  
  @IBOutlet weak var testLabel: UILabel!
  
  
  // Get data values when they are updated
  func peripheral(peripheral: CBPeripheral, didUpdateValueForCharacteristic characteristic: CBCharacteristic, error: NSError?) {
  
      self.statusLabel.text = "Connected"
      var test:UInt32 = 0
      characteristic.value?.getBytes(&amp;test,range: NSRange(location: 0, length: 1))
      Humidity.text = test.description
      print("Humidity\(test)")
      //    print("tst\(characteristic.value?.bytes)")
  
      var test1:UInt16 = 0
      characteristic.value?.getBytes(&amp;test1,range: NSRange(location: 1, length: 1))
      Temperature.text = String(test1)
      print("Temperature\(test1)")
  
  
  
  }
  
  }
  </code></pre>