I have an iOS app whose Core Data model I'm trying to migrate to a new version.
There is one new field (photoFilename) in v2 of the Core Data model, and it's value can be generated for existing entries using a v1 field (dateInSeconds) and appending '.jpg'.
For example
version 1 | version 2
field data | field data
========================================|==============================
dateInSeconds (Integer 32) 401760341 | dateInSeconds (Integer 32) 401760341
| photoFilename (String) 401760341.jpg
I have created a core data mapping model (partially shown below), and the database appears to migrate. Unfortunately, the photoFilename created does not give the correct number in front of the '.jpg'. For example, it might return '275263312.jpg' instead of '401760341.jpg'
Now admittedly, I've never used such mapping before and the Apple documentation here seems very limited.
Researching elsewhere it appears the the 'value expression' is a type of NSExpression and can be replicated for testing purposes.
NSExpression *expr = [NSExpression expressionWithFormat:@"FUNCTION('', 'stringByAppendingFormat:', '%d.jpg', 401760341)"];
id result = [expr expressionValueWithObject:nil context:nil];
NSLog(@"result: %@", result);
However, this evaluates similarly with an incorrect number in front of '.jpg'.
Can someone point out why the evaluated result obtained is not my expected result?