Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJoshua Archer
6,343 PointsI assigned an NSNumber literal to 4, but I'm not sure how to get that number to be equal to 'thing'. Guidance please?
I assigned an NSNumber literal to 4, but I'm not sure how to get that number to be equal to 'thing'. Guidance please?
1 Answer
Alfian Losari
9,495 PointsDo you mean you want to assign your NSNumber value to a primitive data type such as int?, NSNumber is not a primitive data type, so you cannot assign it directly to the primitive variable. To assign it, you must use the method [YourNSNumbeVariableName intValue] to the expression.
Example: NSNumber *myNumber = @4; int number = 3 + [myNumber intValue];