• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data Relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data Relationships


  • Subject: Re: Core Data Relationships
  • From: Julio Cesar Silva dos Santos <email@hidden>
  • Date: Thu, 5 Apr 2007 08:22:00 -0300

Your relationship must receive an object, not a string. Change the 4th line to:

[version setValue:newVersion forKeyPath:@"product_version"];

Julio Cesar Silva dos Santos
email@hidden
Skype: jcssantos01
Blogjective-C
http://www.jcs.santos.nom.br/wp
FetchYourLyrics
http://www.jcs.santos.nom.br/fyl/fyl.html


On Apr 5, 2007, at 6:33 AM, Matt D wrote:

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


References: 
 >Core Data Relationships (From: Matt D <email@hidden>)

  • Prev by Date: Re: Core Data and Views
  • Next by Date: Re: CoreData multithreading question: locking multiple contexts
  • Previous by thread: Re: Core Data Relationships
  • Next by thread: Core Data and Views
  • Index(es):
    • Date
    • Thread