我有一个 NSMutableData 对象给我带来了一些麻烦,我试图从对象中删除最后 6 个字节,如下所示
NSMutableData *reducedDataPacket = [[NSMutableData alloc] init];
reducedDataPacket = [myCompressedData copy];
NSRange range = NSMakeRange([reducedDataPacket length]-6, 6);
[reducedDataPacket replaceBytesInRange:range withBytes:NULL length:0];
但是,一旦最后一行执行我的应用程序崩溃,我就会在下面留下这个错误。
-[NSConcreteData replaceBytesInRange:withBytes:length:]: unrecognized selector sent to instance 0x1f037870
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteData replaceBytesInRange:withBytes:length:]: unrecognized selector sent to instance 0x1f037870
我以前从未尝试过这样做,并且一直在关闭我调查过的其他答案,但我无法让它发挥作用......任何帮助将不胜感激。