Re: Using an empty string as the default value for a Core Data attribute in the XCode modeller
Re: Using an empty string as the default value for a Core Data attribute in the XCode modeller
- Subject: Re: Using an empty string as the default value for a Core Data attribute in the XCode modeller
- From: Frank Reiff <email@hidden>
- Date: Wed, 5 Sep 2007 17:44:21 +0200
Dear mmalc,
Modify the model immediately after reading it from disk.
Right, so if I modify the model programmatically when it first gets
loaded, I can have a @"" default value without needing to sub-class
NSManagedObject.. excellent.
I hadn't even suspected that you could programatically modify the
model, but it should work fine:
Editing Models Programatically
Managed object models are editable until they are used by an object
graph manager (a managed object context or a persistent store
coordinator). This allows you to create or modify them dynamically.
However, once a model is being used, it must not be changed. This
is enforced at runtime—when the object manager first fetches data
using a model, the whole of that model becomes uneditable. Any
attempt to mutate a model or any of its sub-objects after that
point causes an exception to be thrown. If you need to modify a
model that is in use, create a copy, modify the copy, and then
discard the objects with the old model.
Thanks for the tip.
Best regards,
Frank
On 5 Sep 2007, at 17:34, mmalc crawford wrote:
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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