//服务器返回result
result = {
message = "\U83b7\U53d6\U6210\U529f";
randnum = 6;
result = 0;
}
//1.取得result中的NSInteger类型randnum
NSInteger randnum = [[result objectForKey:@"randnum"] integerValue];
Byte byteData[5] = {0x52, 0x11, 0xB0, 0x00, 0xF3};
//强制转为Byte类型
byteData[3] = (Byte)randnum;
NSData *data = [NSData dataWithBytes:byteData length:5];
[self peripheral:_peripheral sendDataToPeripheral:data forCharacter:characteristic];
//例:
float f = 0.0f;
unsigned char *bytes = (unsigned char *)&f;
//然后访问bytes[0],bytes[1],bytes[2],bytes[3]就可以了