Custom Entity Migration Policies - atribute from NSString To NSDate
Custom Entity Migration Policies - atribute from NSString To NSDate
- Subject: Custom Entity Migration Policies - atribute from NSString To NSDate
- From: Anthony Mittaz <email@hidden>
- Date: Sun, 27 Jan 2008 19:28:44 +1000
Hello,
I am having a little bit of trouble figuring how can a set up a custom
entity migration policies for my 2 data models. What I can tell you is
that i m using leopard, and my app is targeting leopard only, so I am
using IB3. I have 2 different models set up using IB3 (Design - Data
Model - Add Model Version, witho both a different Model Version
Number, and I set up a Mapping Model using IB3 as well, in my code I
am using NSMigratePersistentStoresAutomaticallyOption. So basically if
I am doing a migration between my two models it went just fine, for
basic operations.
So what I am currently trying to achieve is the migrate a string value
into a date value, and I think the best solution would be to use a
Custom Entity Migration Policy.
Here is how i can get back my string into a NSDate, it is working well:
NSDateFormatter *dateFormatter = [[NSDateFormatter
alloc]initWithDateFormat:@"%A %d-%b-%y" allowNaturalLanguage:NO];
NSDate *aDate = [dateFormatter dateFromString:myStringToConvert];
How can I set my mapping model in IB3 telling him a would like to use
a custom entity migration for my attribute NSString who has to be
converted into a NSDate ?
I rode the PDF "CoreDataVersioning" explaining this in page 20 but at
least for me it is not clear what should I do.
If there is someone kind enough to explain me this in details it would
be great.
Thanks
Anthony Mittaz
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden