Re: TableView crash with Delegate
Re: TableView crash with Delegate
- Subject: Re: TableView crash with Delegate
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Tue, 14 Jun 2016 11:33:02 +0700
> On 13 Jun 2016, at 21:43, Alastair Houghton <email@hidden> wrote:
>
> On 12 Jun 2016, at 10:10, Gerriet M. Denkmann <email@hidden> wrote:
>>
>> OS X 10.11.5, Xcode Version 7.3.1 (7D1014).
>>
>> App with TableView (View based). Works fine.
>> But when I give the TableView a delegate (even without implementing any NSTableViewDelegate methods) it crashes (see below).
>>
>> How to debug this?
>> Tried a symbolic breakpoint in -[__NSArrayM objectAtIndex:] - but it crashes before reaching breakpoint.
>
> Set it to break on exceptions (or put a breakpoint on objc_exception_throw), then go back up the call stack?
This ultimately let me to the root of the problem:
My app has only one TableView, which is bound to Array Controller.
Array Controller binds its Content Array to AppDelegate with Model Key Path self.someUniqueObject.aMutableArray.
When the app starts a unique someUniqueObject gets created.
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.
Solution: move the creation of someUniqueObject to applicationDidFinishLaunching:
Thanks for your help!
Kind regards,
Gerriet.
_______________________________________________
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