重复的 NSLog 条目
我不知道我是否可以在此处包含相关的代码,因为我的项目如此之大,但是是否有任何典型原因导致 NSLog
会在只有一个警告的情况下重复一些警告并调用它发生呼叫/错误?
举个例子,我有一个 NSBox
的子类,它在 awakeFromNib
上初始化另一个类的实例:
- (void) awakeFromNib {
burbControllerInstance = [[BurbController alloc] init];
if (burbControllerInstance) {
NSLog(@"init ok");
}
}
我得到 NSLog
打印“init ok”两次。我不明白为什么这个子类会在我的项目中的任何地方被“唤醒”两次。这是一个更大问题的一部分,我无法让变量从我正在创建其实例的类中返回除 nil
之外的任何内容。我想知道双重值是否与此有关。
I don't know if it's possible for me to include code here that's relevant as my project is so large but are there any typical reasons why NSLog
would repeat some warnings and calls to it at occasions where only one call/error is occuring?
As an example, I have a subclass of NSBox
that inits an instance of another class on awakeFromNib
:
- (void) awakeFromNib {
burbControllerInstance = [[BurbController alloc] init];
if (burbControllerInstance) {
NSLog(@"init ok");
}
}
I get NSLog
printing "init ok" twice. I don't see why this subclass would be 'awoken' twice anywhere in my project. This is part of a larger problem where I can't get variables to return anything but nil
from the class I'm creating an instance of. I'm wondering if perhaps the double values are something to do with it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这篇文章可能会有所帮助,即一条评论:
更新:更有趣的还有this,其中作者提到
awakeFromNib
被调用两次。不幸的是,这个特定问题没有真正的答案,但也许有一些基本的想法。更新 #2: stackoverflow.com 的另一个潜在解决方案:视图控制器调用awakeFromNib 两次。
This post could be helpful, i. e. one comment:
Update: Much more interesting could also be this, where the author mentions that
awakeFromNib
gets called twice. Unfortunately there is no real answer for this particular problem but maybe some basic ideas.Update #2: Another potential solution from stackoverflow.com: View Controller calls awakeFromNib twice.