2
votes

I am working with iOS central to communicate with BLE peripheral device.

Using LGBluetooth framework https://github.com/DavidSahakyan/LGBluetooth

The method gets

        [LGUtils readDataFromCharactUUID:aCharactId
                              seriveUUID:aServiceId
                              peripheral:peripheral
                              completion:^(NSData *data, NSError *error) {
                                  NSLog(@"Data : %s Error : %@", (char *)[data bytes], error);
                              }];

It outputs "1234567890"

I need to convert (char *) [data bytes] to NSInteger. When I get it

         NSInteger dataInt = [data bytes];

I get 2013527536, but the value is 1234567890 on peripheral side

1
Above link doesn't workDAMM108

1 Answers

1
votes

Try to do something like that:

NSInteger dataInt = atoi((const char*)[data bytes]);