Weak link usage? @property?
Weak link usage? @property?
- Subject: Weak link usage? @property?
- From: Scott Squires <email@hidden>
- Date: Mon, 21 Jul 2008 15:07:14 -0700
So what's the correct form of weak linking to avoid retain cycles?
If I have an instance variable in my child of it's parent:
@interface MyChild blah blah...
{
MyParentClass * myParent;
}
@property (nonatomic) MyParentClass * myParent;
Provides this warning.
warning: no 'assign', 'retain', or 'copy' attribute is specified -
'assign' is assumed
warning: 'assign' attribute (default) not appropriate for non-gc
object property 'myParent'
Do I need to avoid any @property settings for any weak linked objects
and just deal with directly in my methods?
Other question on @property retaining
@property (nonatomic, retain) MyClass *myClass;
-(void)holderOfMyClass:(MyClass *)myClassObject;
{
[self setMyClass: myClassObject]; // this retains
self.myClass = myClassObject; // this retains
myClass = myClassObject; // this does not retain? Seems like it
doesn't from my tests
}
_______________________________________________
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