• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Weak link usage? @property?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Weak link usage? @property?
      • From: Marco Masser <email@hidden>
    • Re: Weak link usage? @property?
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: Breakpoints for CG* functions
  • Next by Date: Re: Weak link usage? @property?
  • Previous by thread: Re: Breakpoints for CG* functions
  • Next by thread: Re: Weak link usage? @property?
  • Index(es):
    • Date
    • Thread