How to:
if (myNSNumber == 1)
{
...
}
This doesn’t seem to build
The object:
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If myNSNUmber is
NSNumber, your code should read,If it is
NSInteger, you can directly compare it with an integer literal. BecauseNSIntegeris a primitive data type.Note: Make sure you don’t have
*in your declaration. YourNSIntegerdeclarations should read,The following is based on @BoltClock’s answer, which he recently posted here
However if you do need to use a pointer to an NSInteger (that is, NSInteger *) for some reason, then you need to dereference the pointer to get the value: