문제

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

도움이 되었습니까?

해결책

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"];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top