On Oct 27, 2012, at 4:51 PM, H Miersch <hmier...@me.com> wrote:

> in the app delegate itself, there's this line, in 
> applicationDidFinishLaunching:
> 
> clients = [[NSMutableArray alloc] init];
> 
> that works as expected. so far so good. but later, in another method in the 
> app delegate, there's this line:
> 
> int count = [clients count];

Set a breakpoint on both the lines you quoted above, and see which one gets hit 
first. -applicationDidFinishLaunching: is not necessarily the first method 
invoked on the application delegate; it gets instantiated when the nib loads, 
and there can be activity during nib loading that ends up calling methods in 
the delegate.

In general, initialization code like this in a nib-loaded object should go into 
its -awakeFromNib method, which is [almost] guaranteed to be the first method 
invoked on that object.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to