Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 4, 2006, 06:55 PM   #1
HungrySeacow
macrumors regular
 
Join Date: Jan 2006
Location: West Palm Beach
Need a little help with CoreData, insertNewObjectForEntityForName:

Anyone here think they can help me with this problem with CoreData? I need a method that will add an object to an entity, whose contentSet is bound to another entities selection. Right now I have:
Code:
NSManagedObject *source;
source = [NSEntityDescription insertNewObjectForEntityForName:@"secondEntity"
             inManagedObjectContext: [self managedObjectContext]];
Unfortunately, this doesn't work because it is bound to the contentSet of another entity.
__________________
|||||| YummySoup! - Recipe management and sharing at its best!
HungrySeacow is offline   0 Reply With Quote
Old Apr 4, 2006, 10:34 PM   #2
HungrySeacow
Thread Starter
macrumors regular
 
Join Date: Jan 2006
Location: West Palm Beach
OK, I have created a sample program that demonstrates my problem:
http://www.hungryseacow.com/Personal...aTableView.zip

The Manual Add Method button for the Source managedObject works fine, However the one for the Results managedObject does not. Take a look at the methods in the __AppController.m file

- (IBAction)addResultid)sender
and
- (IBAction)addSourceid)sender

Now if you look at the Results NSArrayController, you can see that it has two bindings, the contentSet is bound to the Source's selection. There must be some way to modify this method to get it to also work with the contentSet.

Code:
- (IBAction)addResult:(id)sender
{
	NSLog(@"addResult called");
		NSManagedObject *source;
		source = [NSEntityDescription insertNewObjectForEntityForName:@"Result"
												  inManagedObjectContext: [self managedObjectContext]];
		[[self managedObjectContext] processPendingChanges];
		
}
__________________
|||||| YummySoup! - Recipe management and sharing at its best!
HungrySeacow is offline   0 Reply With Quote
Old Apr 5, 2006, 03:43 PM   #3
HungrySeacow
Thread Starter
macrumors regular
 
Join Date: Jan 2006
Location: West Palm Beach
I don't know why I didn't think of this before! I fixed the problem. I created an IBOutlet to the NSArray Controller called resultArrayController and then sent it this message:
Code:
	NSManagedObject *source;
	[resultArrayController add: source];
EDIT: Sorry the solution that I had before was wrong, now it has been corrected.
__________________
|||||| YummySoup! - Recipe management and sharing at its best!

Last edited by HungrySeacow; Apr 5, 2006 at 10:23 PM.
HungrySeacow is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Need a little help with some keys please! ErasmusŪ Mac Peripherals 8 Dec 12, 2006 04:16 PM
New to Mac World Need a little help with Mac Server viper75 Mac Basics and Help 5 Nov 1, 2005 12:19 PM
Printfab - need a little help with Canon MP390 printer chriskzoo Mac Applications and Mac App Store 0 Aug 28, 2005 08:06 PM
I need a little help with a photoshop action dfinn Design and Graphics 1 Aug 10, 2005 11:30 PM
Need a little help with networking my mac to a pc network flounder General Mac Discussion 1 Jan 22, 2004 10:05 AM


All times are GMT -5. The time now is 12:29 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC