After migration, one of my numerical values that should be non-zero now appears as zero. If I don't migrate, the value retains its non-zero value.
I first tried to set a number value in a managed object like this:
[temp setNumUses:temp.numUses+1];
... but that caused an'EXC_BAD_ACCESS' so I changed it to:
int hold = ((int)[[temp valueForKey:@"numUses"] intValue]);
hold++;
[temp setNumUses:[[NSNumber alloc] initWithInt:hold]];
... but after migration, this code claimed that hold
was initialized as an int with a value of 0 when before running the new code its value was clearly 1 or more (referring to the test object which was used only 1 time).
When I do not migrate the Core Data Database the NSNumber retains its value fine through many context saves and application terminations.
What might I be missing? I have some extensive code that modifies values of changed NSManagedObjects in a database stored elsewhere but none of it tampers with 'numUses'.
Thoughts?