NSInteger and NSUInteger in a mixed 64bit / 32bit environment

I think the safest way is to box them into NSNumber instances.

NSLog(@"Number is %@", @(number)); // use the highest level of abstraction

This boxing doesn’t usually have to create a new object thanks to tagged pointer magic.

If you really don’t want to use NSNumber, you can cast primitive types manually, as others suggested:

NSLog(@"Number is %ld", (long)number); // works the same on 32-bit and 64-bit

Leave a Comment