Why does this not work:
NSInteger temp = 20;
[userSettingsFromFile setObject:temp forKey:@\"aTemp\"];
but this does:
[userS
NSInteger is synonym for long integer.What follows is how NSInteger is defined:
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
NSNumber is an Objective-C class, a subclass of NSValue to be specific. You can create an NSNumber object from a signed or unsigned char, short int, int, long int, long long int, float, double or BOOL
One of the primary distinctions is that you can use NSNumber in collections, such as NSArray, where an object is required. For example, if you need to add a float into an NSArray, you would first need to create an NSNumber object from the float:
float percentage = 40.5;
... // Create NSNumber object, which can now be inserted into an NSArray
NSNumber *percentageObject = [NSNumber numberWithFloat:percentage];