Skip navigation.
 
mlRe: CoreData: Can't modify an immutable model
FROM : Ben Trumbull
DATE : Tue Feb 05 23:43:02 2008

>>Ben,
>>
>>Are you talking about insertNewObject
>>ForEntityForName:inManagedObjectContext: ?  Do I understand correctly
>>that the moc parameter is in fact optional?  The docs don't say so, but
>>I have always wished it was the case.  Can you confirm?  (I'd like to be
>>able to set some attributes before NSObjectControllers go changing the UI).

>
>Yes it is optional, but it's not for the faint of heart.  You won't
>get relationship maintenance, undo, or the standard notifications
>until you call -insertObject:



Eh.  Sorry, my last message was wrong.  The convenience methods on
NSEntityDescription will not take a nil context because the MOC is
the only way a class method can find your model.

If you want to create, but not insert, a managed object, you'll have
to use the designated initializer.

But -initWithEntity:insertIntoManagedObjectContext: really will take
a nil MOC, honest!

More coffee ...
--

-Ben

Related mailsAuthorDate
No related mails found.