I have a bizarre problem with a ‘double’ property in Core Data.
I have isolated the problem in these two lines:
newStrategy.order = 444.0;
NSLog(@"Order is %f", newStrategy.order);
The output of that NSLog is:
Order is nan
newStrategy type is ‘Strategy’, one of the entities I have defined in Core Data. The ‘order’ property is declared as
@property (nonatomic) double order;
in a Core Data generated file.
Of course, when data is saved, the ‘order’ is not stored as 444.0. The strange situation is that I have other Core Data entities (with associated files) that use a similar ‘order’ property, as a double, and they gave me no problems at all in similar operations.
Any idea? Thanks in advance.
Some inconsistency in the Core Data model was the cause, so recreating the attribute helps. I changed it from ‘double’ to ‘float’, in the model and in the .h files. Then, I went back to a ‘double’ again and now it’s working.