我正在使用 iOS 中心与 BLE 外围设备进行通信。
使用 LGBluetooth 框架https://github.com/DavidSahakyan/LGBluetooth
该方法得到
[LGUtils readDataFromCharactUUID:aCharactId 服务UUID:aServiceId 外围:外围 完成:^(NSData *data, NSError *error) { NSLog(@"Data : %s Error : %@", (char *)[data bytes], error); }];
它输出“1234567890”
我需要将 (char *) [data bytes] 转换为 NSInteger。当我得到它
NSInteger dataInt = [数据字节];
我得到 2013527536,但外围端的值为 1234567890