If an optional Core Data property has a default value set in the model editor, then:
Core Data never stores nil for that property — it immediately populates new objects with the default value.
That means even if you never explicitly set it, reading it will return the default (e.g., 0), not nil.
valueForKey: will also return an NSNumber with that default value, not nil.
How to allow nil detection:
Leave it as optional.
After that, Core Data will store nil if you don’t set a value.
Now you can detect nil using valueForKey: or by declaring it as an NSNumber *.