Search code examples
cocoa-touchbytexcode4.3nsdata

Xcode (Cocoa) how to write byte to NSData


Xcode...

I want to write one byte (1) to NSData. It seems very simple but im not able to find the proper link how to do it. I try to do that using unsigned char. But that stores the hex value.


Solution

  • You cannot add bytes to NSData use NSMutableData appendBytes:bytes length: method