Skip to content

Instantly share code, notes, and snippets.

@Qiki
Created September 8, 2014 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qiki/3f86f1f0c99f2320fbbd to your computer and use it in GitHub Desktop.
Save Qiki/3f86f1f0c99f2320fbbd to your computer and use it in GitHub Desktop.
Different between NSInteger and NSNumber
NSInteger is a type definition that describes an integer - but it is NOT equivalent to int on 64-bit platforms.
NSInteger is defined as int when building a 32-bit app and as long for 64-bit apps.
NSNumber is a class that helps you to store numeric types as object. It has methods to convert between different types and methods to retrieve a string representation of your numeric value.
If you use a variable day of type NSNumber* the way you did in your example, you are not modifying the value of day but its memory address.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment