Core Data Relationships
Core Data Relationships
- Subject: Core Data Relationships
- From: Matt D <email@hidden>
- Date: Thu, 5 Apr 2007 02:33:42 -0700
Hello everyone,
I have discovered the awesome power of the Core Data system. I have
one question though. I have set up relationships (which work just
fine) and crated an application. The application has a list on the
left with projects and a tab view on the right. In the tab view, you
can switch to different views to add versions and bugs. I have just
been adding data to the versions and bugs though a table view, but
want to have a window pop up and enter the values. I have no problem
with popping up the window, etc, but I am stuck on saving the data..
This is my current code:
NSManagedObjectContext * context = [[NSApp delegate]
managedObjectContext];
NSManagedObject * version = nil;
version = [NSEntityDescription
insertNewObjectForEntityForName:@"BCVersions"
inManagedObjectContext:context];
[version setValue:[newVersion stringValue]
forKeyPath:@"product_version"];
My only problem is that it is not saving to the relationship it has
with BCProducts. I thought this would happen automatically, but I
guess it doesn't? The data does add, but without the relationship of
corse. I have read several documents from apple about Core Data and
can't find my answer. I bet it is staring at me somewhere close, but
I don't see it...
Anyway, I appreciate any help going in the right direction!
Thanks,
Matt D
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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