简体   繁体   English

将NSData分成较小的NSMutableData对象

[英]Separate NSData into smaller NSMutableData objects

I am unsure of how to separate a NSData object into smaller parts so that I can send it over bluetooth. 我不确定如何将NSData对象分成较小的部分,以便可以通过蓝牙发送它。 I believe it is a method similar to this: 我相信这是与此类似的方法:

- (void)getBytes:(void *)buffer range:(NSRange)range

I do not know what to pass in for the buffer. 我不知道为缓冲区传递什么。 Do I just pass in a NSMutableData object to hold the bytes that I pull out of the original NSData? 我是否只是传入NSMutableData对象来保存从原始NSData中拉出的字节?

Thanks 谢谢

您可以使用-subdataWithRange:方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM