In my main data model, I have an object with the optional NSNumber attribute.
How to check if the value in this attribute is really specified?
When I test zero ... doesn't work.
[self numberAttribute] == nil
When I test a null int value, this does not work.
[[self numberAttribute] intValue] == 0
Essentially, [[self numberAttribute] intValue]] returns what looks suspiciously like a pointer to a memory address.
Does anyone know what I'm doing wrong?
EDIT: OK, the error was in a completely unrelated part of the code. NSNumber and Core Data function exactly as you would expect. However, I'm going to move on to the proposed approach to make the attribute non-optional and specify 0 as the default value.
Just posting this note here a little, for those who looked at this question, I delete it.
objective-c iphone cocoa-touch core-data nsnumber
mmc
source share