NSManagedObject and weak references under GC
NSManagedObject and weak references under GC
- Subject: NSManagedObject and weak references under GC
- From: Rob Keniger <email@hidden>
- Date: Wed, 4 Nov 2009 15:41:45 +1000
Hi all,
I'm converting my garbage-collected document-based application to use
Core Data. In my existing implementation, several NSViewControllers
keep weak references to the NSDocument object by using the __weak
attribute:
@interface MyController : NSViewController
__weak MyDocument* document;
@end
This is so that when a document window is closed, the memory for the
document is freed. This works fine.
The document in turn has a property specified like so:
@property (readonly) NSString* foo;
However, now that I've switched the document to be a subclass of
NSPersistentDocument, I am getting compilation errors in my
NSViewController subclass when it tries to access the foo property of
the document:
document.foo = @"bar";
-> error: property 'foo' not found on object of type 'MyDocument
*__attribute__((objc_gc(weak)))'
Why would this compiler error be occurring?
--
Rob Keniger
_______________________________________________
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