nsmanagedobject - Core Data check if property has never been set -
Is there a way to check whether the NSManagedObject property, for example a float NSNumber, in which the default value is = 0, is already Setter in Setter?
I tried to do something like this:
- (zero) setQuantity: (NSNumber *) Quantity {if (self.quantity == zero) NSLog (@ " Property never been determined "); Other NSLog (@ "property is already set"); [Will Will Changewellfall: @ "Quantity"]; [Self setmimicity: volume]; [Aunt Keweckenzvlevforki: @ "Volume"]; }
But "Quantity" is never started because the default value is started with. Thanks!
If the attribute has a default value set during is Start. You have 2 options:
- Mark the attribute as optional and do not provide the default value. You can check for zero
- Make sure the default value is unique and to determine that the value has been changed since the initialization, check the contrast eg, otherwise the positive number For, use
-1
.
Warning for 1: Make sure that the attribute in your code is not set to zero
anywhere. Warning for
2: Make sure the code is set to a specific value.
Comments
Post a Comment