Hitarth Hitarth - 3 months ago 25
Objective-C Question

Difference between int, NSInteger and NSUInteger

What is the main difference between

int
,
NSInteger
and
NSUInteger
in Objective-C?

Which one is better to use in an application and why?

Answer

In such cases you might right click and go to definition:

#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif