NSWindowController showWindow 在其他 Mac 上导致问题

发布于 2024-11-10 01:25:17 字数 841 浏览 0 评论 0原文

我正在对我的新 Mac 应用程序进行 Beta 测试,该应用程序在我的两台 MacBook Pro 和另一台 Beta 测试人员的 iMac 上运行良好。但对于我的另外两个 Beta 测试人员(两者都具有与我完全相同的 osx,10.6.7),我的应用程序窗口在启动时不会打开。

在检查他们的控制台日志后,我将问题范围缩小到对我的类 MainWindowController(NSWindowController 的子类)的 showWindow 调用。

m_pMainWindowController= [[MainWindowController alloc] initWithWindowNibName:MAIN_WINDOW_NIB_NAME];
[m_pMainWindowController showWindow:nil];   

showWindow 调用会触发调用所有 viewController 的 awakeFromNib 方法,这一切似乎都正确发生,但在 showWindow 返回之前,此消息从我的应用程序发送到控制台:

-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (0) not equal to number of keys (2)
-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (0) not equal to number of keys (2)

我发现此错误很难修复,因为我无法在我的 Mac 上重现它,而且它似乎并非源自我的任何代码。

任何见解将不胜感激。

I'm beta testing my new Mac App which works great on my two MacBook Pro's, and on one other beta tester's iMac. But with two other of my beta testers (both having the exact same osx as I do, 10.6.7) my app window won't open at launch.

Upon inspecting their console logs, I narrowed the problem down to the showWindow call on my class MainWindowController, a subclass of NSWindowController.

m_pMainWindowController= [[MainWindowController alloc] initWithWindowNibName:MAIN_WINDOW_NIB_NAME];
[m_pMainWindowController showWindow:nil];   

The showWindow call triggers all the viewController's awakeFromNib methods to be called and this all seems to happen correctly, but right before showWindow is to return, this message is sent to the console from my app:

-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (0) not equal to number of keys (2)
-[__NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (0) not equal to number of keys (2)

I am finding this bug very hard to fix because I can't reproduce it on my Macs, and it doesn't appear to be originating in any of my code.

Any insight would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黯然 2024-11-17 01:25:17

我想通了。问题出在drawRect函数中。我正在初始化 NSDictionary 的字体属性,并且没有检查是否可以加载某种字体。因此将 nil 加载到 NSDictionary 中。典型的菜鸟错误。

I figured it out. The problem was in a drawRect function. I was initializing a NSDictionary for font attributes, and did not check to see if a certain font was available to be loaded. Thus loading a nil into an NSDictionary. Classic noob mistake.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文