Home > Back-end >  How to add default string to attribute during CoreData migration
How to add default string to attribute during CoreData migration

Time:09-11

I have a simple Coredata program for cataloging some data - coded in Objective-C. A new model version was created that has a new attribute. A mapping model has been created, it is not inferred. The migration is working great, however, after migration the new attribute is empty - which is expected. I would like to add a placeholder string value to the new attribute during the migration process. The two thoughts I have is to either place custom code in the value expression of the mapping model or subclass NSMigrationPolicy and add code there, but I have not found much information regarding either. Any suggestions?

Thank You in advance

CodePudding user response:

The Value Expression in the mapping model can be a constant value expression like string "placeholder" or integer 1.

  • Related