For example when passing a value
message to an NSInteger
instance like so
[a value]
it causes an EXC_BAD_ACCESS.
So how to convert an NSInteger
to int
?
If it's relevant only small numbers < 32 are used.
Ta da:
NSInteger myInteger = 42;
int myInt = (int) myInteger;
NSInteger
is nothing more than a 32/64 bit int. (it will use the appropriate size based on what OS/platform you're running)