NSMutableString *tosend=[[NSMutableString alloc] init];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
NSData *valData = [tosend dataUsingEncoding:NSUTF8StringEncoding];
[peripheral writeValue:valData forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse];这样也不行
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
[tosend appendString:[NSString stringWithFormat:@"%c",0]];
NSData *valData = [tosend dataUsingEncoding:NSUTF8StringEncoding];
[peripheral writeValue:valData forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse];这样也不行
解决方案 »
- 新手,ios画图计算器编法
- .net解析ios服务器端xml文件,怎么弄啊,急急急急,在线
- iPhone里pdf的文字搜索和批注能否实现?
- ios两个程序融合
- 求推荐关于 IOS 依赖注入比较流行的框架或者资源。
- 问题标签用户 UItableView 点击不回调didSelect
- CodeSign error: code signing is required for product type 'Application' in SDK '
- MAC终端下如何编译arm64平台的可执行文件?
- storyboard中如何在tableview头视图上添加一个scrollview
- ipad播放h5 video标签视频时 如何取消内联样式?求大神教育。
- 新手,问个基础问题
- objc的单例问题
2、0x00000000 存储是就是 0.
3、peripheral 是什么?一个 Socket 封装?
NSMutableData *data=[[NSMutableData alloc] initWithCapacity:0];
int8_t byte0 = 0xfe;
[data appendBytes:&byte0 length:sizeof(byte0)];
int8_t byte1 = 0x82;
[data appendBytes:&byte1 length:sizeof(byte1)];
int8_t byte2 = 0x00;
[data appendBytes:&byte2 length:sizeof(byte2)];
int8_t byte3 = 0x00;
[data appendBytes:&byte3 length:sizeof(byte3)];
int8_t byte4 = 0x00;
[data appendBytes:&byte4 length:sizeof(byte4)];
int8_t byte5 = 0x02;
[data appendBytes:&byte5 length:sizeof(byte5)]; NSLog(@"%@",data);//<fe820000 0002> [_peripheral writeValue:data forCharacteristic:_characteristic type:CBCharacteristicWriteWithResponse];