I am using Core Data for my app and I have a model Reservation and there I have a facebook_event_id which at first I had as a Integer 64 but the problem is that this is perhaps to short and I would like it to change to NSString (I get it as JSON string from Facebook anyway).
I have done the following for now:
- Editor -> Add model version and based it on my older one
- rebuild my subclasses
- added this dict with NSMigratePersistentStoresAutomaticallyOption and NSInferMappingModelAutomaticallyOption set to YES
When I tested it to change between Integer 16 and 64 everything worked fine but when I try to change from Integer 64 and String it gives me an error:
Can't find or automatically infer mapping model for migration
So I added a new mapping model and there I wanted to fix it in ReservationRoReservation | facebook_event_id | $source.facebook_event_id
I think one should do something with $source.facebook_event_id to get it converted but I have no idea what to write in the to get it to work. One should not use plain Objective-C there but a NSExpression, but nowhere there it explains how to convert a NSNumber to a NSString.
I think you want:
Which will take the NSNumber currently in your facebook_event_id property, and send the stringValue message to it.