in a new model version, the entities of my data model got some additional attributes; among others they got (mandatory) timestamp and identifier fields. The timestamps are of type NSDate, the identifiers are of a custom UUID type that supports the NSCoding protocol whence Core Data can store it as NSData.
Since these attributes are mandatory, I need to assign reasonable values during the migration. For the timestamps, it is ok if every timestamp becomes @[NSDate distantPast]@. The identifiers need to be unique for obvious reasons whence I need to generate for every instance a random identifier, e.g. using the convenience constructor @[UUID uuid]@.
The Mapping Model in XCode lets me define value expressions for the destination entities’ attributes. Unfortunately, I can’t find a comprehensive documentation of the value expression syntax. The Predicate Programming Guide has a section Predicate Format String Syntax but that does not mention the “Function” expression at all.
The NSExpression Class Reference describes the syntax as FUNCTION(receiver, selectorName, arguments, …). Unfortunately, the migration fails to assign proper values if I use the value expressions FUNCTION(NSDate, “distantPast”) and FUNCTION(UUID, “uuid”), respectively - the migration manager complains in the validation phase that the corresponding attributes have no values.
Do you know of additional documentation that may explain what I am doing wrong? Or do you know another approach (short of implementing custom migration managers for every entity) that assigns proper values to the destination entities’ attributes?