Skip navigation.
 
mlHow to programmatically create an NSObjectController in Entity mode?
FROM : Sean McBride
DATE : Tue Apr 29 19:04:59 2008

Hi all,

How does one programmatically create an NSObjectController in Entity
mode?  I've tried all kinds of orderings of calls but can't get it do work.

1) the docs don't say what the designated initializer is.  Is it
initWithContent?  What should be passed as 'content'?  Is nil acceptable?

2) I've tried:

   myController = [[NSObjectController alloc] initWithContent:nil];
   [myController setManagedObjectContext:[self managedObjectContext]];
   [myController setEntityName:@"MyEntity"];
   [myController setAutomaticallyPreparesContent:YES];

But when I do 'po' in gdb it reveals that it's in Object mode:

(gdb) po myController
<NSObjectController: 0x3a895a0>[object class: NSMutableDictionary]

An archive post suggests this is a bug in NSObjectController's
description, but I can't be sure.  In any case, [myController content]
always gives nil.

What is the correct way to programmatically creates these things?

Thanks,

--
____________________________________________________________
Sean McBride, B. Eng                <email_removed>
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

Related mailsAuthorDate
mlHow to programmatically create an NSObjectController in Entity mode? Sean McBride Apr 29, 19:04
mlRe: How to programmatically create an NSObjectController in Entity mode? I. Savant Apr 29, 19:19