Re: TableView crash with Delegate
Re: TableView crash with Delegate
- Subject: Re: TableView crash with Delegate
- From: Alastair Houghton <email@hidden>
- Date: Tue, 14 Jun 2016 10:03:47 +0100
On 14 Jun 2016, at 05:33, Gerriet M. Denkmann <email@hidden> wrote:
>
> But I had:
> - (void)awakeFromNib
> {
> self.someUniqueObject = [ [ UniqueObject alloc ] init ];
> }
>
> The problem: awakeFromNib gets called twice: once before applicationDidFinishLaunching:, once after.
> This obviously created a total mess.
It’s worth highlighting this, actually; -awakeFromNib gets called for the “File’s Owner” object in the nib file, which means if your object has multiple nib files associated with it, it can get called many times. It’s best (IMO) to always write your -awakeFromNib methods with that in mind (though the documentation recommends trying to maintain a 1:1 correspondence between owners and nib files).
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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