The reason is I must get back the exact value as it was in the property. So if it was a float, I want to call -floatValue. But if it was an int, I want to call -intValue.
Is NSNumber remembering how it was initialized?
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.
NSNumber is toll-free bridged with CFNumber (see, amongst other sources, the text at the top of the CFNumber reference). So you can use CFNumberGetType. E.g.
EDIT: looking more thoroughly at the documentation, CFNumberIsFloatType would appear to do exactly what you want without the complexity. So: