Re: ARC
Re: ARC
- Subject: Re: ARC
- From: Ben Kennedy via Cocoa-dev <email@hidden>
- Date: Fri, 23 Aug 2019 15:36:04 -0700
> On 23 Aug 2019, at 2:17 pm, Casey McDermott via Cocoa-dev
> <email@hidden> wrote:
>
> We allocate the controller in our app delegate class. It's a member but
> apparently that is not a
> strong enough reference, so the controller is released at the end of the
> scope. What is best practice to hold a strong reference on it until the app
> closes?
I suppose you haven't redeclared your ivars as "modern"-style properties (using
`@property` syntax), huh? I'd recommend taking the time to do so. This will
make ownership obvious (via the `strong`/`weak` keywords) and you'll get the
appropriate retention by just assigning to the property. It'll also let you
delete vast swaths of boilerplate accessor code (presuming your code base is of
the vintage I'm guessing it is).
b
_______________________________________________
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
References: | |
| >ARC (From: Casey McDermott via Cocoa-dev <email@hidden>) |