Reputation: 3149
I know this is probably by design but I thought I'd check with the community first.
How come when I have an NSManagedObject that's new, its NSNumber properties return 0? I want them to be nil til they've been set.
Upvotes: 1
Views: 964
Reputation: 90117
Did you just forget to uncheck the default
value option?
The NSManagedObject will return nil for that attribute if default
is unchecked and the attribute was never set. At least that's what happens in my app.
Upvotes: 4
Reputation: 3312
It is a NSNumber behavior. Once it is created but not assigned a value, it is set to 0.
Hope that helps
Upvotes: 0