int is a static type
Nsinteger is a dynamic type
Apple's official recommendation is to use Nsinteger, because in Apple's API implementation, Nsinteger is a package that recognizes the number of bits in the current operating system and automatically returns the largest type.
The code defined is similar to the following:
#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
You usually want the Nsinteger when you don ' t know what kind of processor architecture your code might run on, so Y OU may for some reason want the largest possible int type, which on + bit systems is just an int, while on a 64-b IT system it ' s a long.
The difference between int and Nsinteger in objective-c