I started wondering: Since 'department' is in fact a managed object
and can be fetched, why does MyDocument need it as an instance variable?
Answer: It doesn't! I eliminated the declaration
NSManagedObject *department ;
and also I eliminated the -setDepartment: setter and all invoca
On 2008 Oct, 25, at 13:01, Quincey Morris wrote:
Well, it's not clear what class your -document getter belongs to, or
why you're expecting it to be referenced by code you didn't write.
Core Data knows nothing about documents. NSPersistentDocument
"merely" wraps document behavior around Cor
On Oct 25, 2008, at 12:20, Jerry Krinock wrote:
I also have a more fundamental question. Why must we override -
initWithError:type: to initialize the 'department' ivar for new
documents? It seems like we're "faking it". Generally, best
practice is to allocate objects on-demand. And since
On 2008 Oct, 25, at 9:51, Quincey Morris wrote:
you must force it to be registered (processPendingChanges) and then
you can tell the undo manager to remove it (removeAllActions).
Thank you, Quincey, that makes sense.
I also have a more fundamental question. Why must we override -
initWith
On Oct 25, 2008, at 08:15, Jerry Krinock wrote:
- (id)initWithType:(NSString *)type error:(NSError **)error
{
self = [super initWithType:type error:error];
if (self != nil)
{
NSManagedObjectContext *managedObjectContext = [self
managedObjectContext];
[self setDepartment:
In Apple's DepartmentsAndEmployees Sample Code project, the document
(MyDocument) has this instance variable:
NSManagedObject* department ;
I view this 'department' as special "Document Settings Ivar". There
is always one and only one of them in each document. As a matter of
fact, f