2

I have an object I must encode using encodewithcoder but it's a 'long' number and I'm not sure if I must encode it like a simple int, a int32 or a int64. Apple's documentation doesn't seems to be useful for me to figure out since it never refers to 'long' type.

Which coder is the proper one?.

Thank you

rmvz3
  • 1,133
  • 2
  • 16
  • 27
  • Assuming its impossible to change your property to a known width primitive like int32_t or similar? – nielsbot Mar 19 '13 at 05:06
  • This property is defined in the documentation I've received from the client (a big enterprise). I really don't know what is this property supposed to store. – rmvz3 Mar 19 '13 at 05:52

1 Answers1

3

For iOS, a long is 32-bits, same as an int. long long gives you 64-bits.

long someVar = 42l;
[someEncoder encodeInt32:someVar forKey:@"someKey"];
rmaddy
  • 314,917
  • 42
  • 532
  • 579