0

According to the GNUstep documentation, [NSData bytes] returns const void*.

Does that mean that I'm not supposed to modify the data referenced by that pointer?

Currently I'm modifying the data, and it works for me. I can write to a file and the modified data go there.

not-a-user
  • 4,088
  • 3
  • 21
  • 37

1 Answers1

2

NSData is unmutable by definition. Use NSMutableData instead.`

NSMutableData *mutableData = [[NSMutableData alloc] initWithData:data];
void *pointerToMutableBytes = [mutableData mutableBytes];