You need to declare some method that core date implement for you, for this
situations, to make your life easier XCode help you to declare it and declare
those custom class file declarations:
- At your Core Date model select the entities you want to make a custom class.
- go to Menu File>New File...
- At Cocoa Class or (Cocoa Touch Class, depend what you are doing) you find a
New File Type, Managed Object Class.
- Select it and create the classes.
Then you will see is really easy.
NOTE: When you do this the old implementation you have will me deleted,
refactor it before you make the classes if you don't want to lost what you did
before.
Pablo Pons
El 14/01/2011, a las 12:53, Philip Vallone escribió:
>
> Hi List,
>
> I have an Entity called "CDSites" which has a one-to-many relationship with
> an Entity called "CDPlacemarks". CDSites is the "Parent" and CDPlacemarks are
> the "Children". My Applications allows the users to create many CDSites like
> this:
>
>
> CDSites *cdSites = [NSEntityDescription
> insertNewObjectForEntityForName:@"CDSites" inManagedObjectContext:context];
> cdSites.prjName = self.newDetailsView.prjName;
> cdSites.street = self.newDetailsView.street;
> cdSites.city = self.newDetailsView.city;
> cdSites.state = self.newDetailsView.prjState;
> cdSites.zip = self.newDetailsView.zip;
> cdSites.latitude = [NSNumber
> numberWithFloat:self.newDetailsView.latitude];
> cdSites.longitude = [NSNumber
> numberWithFloat:self.newDetailsView.longitude];
>
>
> NSError *error;
> if (![context save:&error]) {
> NSLog(@"Couldn't save: %@", [error localizedDescription]);
> }
>
>
> CDSites is a subclass of NSManagedObject.
>
> This works well. My question is, I need to create the CDPlacemarks for each
> CDSite. How do I associate my CDPlacemarks with its "Parent" CDSites?
>
> Thanks for the help.
>
> Phil
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/pablo.mailinglists%40gmail.com
>
> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]