开发者

Why is NSObject ini event triggered 2 times?

I have an NS开发者_StackOverflowObject

#import <Cocoa/Cocoa.h>

#import "MyAppDelegate.h"

@interface MyObj1 : NSObject<NSApplicationDelegate> {

}



@end

//
//  MyObj1.m


#import "MyObj1.h"


@implementation MyObj1


-(id)init;
{
    //I set the breakpoint here

}

@end

I set the breakpoint as above, but I found that it always triggers ini event 2 times

I do not know if it is normal or anything wrong?

Welcome any comment


There's an easy way to find out: Just look at the stack trace in the debugger, and you will see how both objects are created. There are certainly two of them, maybe one within a nib and one programmatically. Typically, you never instantiate your app delegate yourself directly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜