I am trying to show data in UITextView by appending data coming from peripheral:didUpdateValueForCharacteristic:error:
. In this case peripheral:didUpdateValueForCharacteristic:error:
is getting called very frequently, due to which UITextView
(self.responseTextView
) is either unable to print any data or blocks the UI.
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
{
if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:UNKNOWN3_CHARACTERISTICS]])
{
NSData *data = characteristic.value;
NSString *stringFromData = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
self.responseTextView.text = [self.responseTextView.text stringByAppendingString:stringFromData];
NSLog(@"%@",stringFromData);
}
}