1

I'm encountering my second problem in three days where an errant binding is causing me hours of searching and headaches.

A glance at the stack trace indicates a problem with debugging (e.g., one of the last methods called before the runtime started generating an exception was bind:toObject:withKeyPath:options:). However, I'm finding it impossible to determine WHICH binding is causing the problem:

  • Nothing in the stack trace or variable inspection indicates which views were involved in the call that crashed.

  • The last non-machine instruction that's traceable by stepping through code is a call to a monolithic function (awakeFromNib or makeKeyAndOrderFront).

  • The message in the actual exception is mystifying - e.g., "Cannot create NSArray from object of class NSScrollView," while creating a window that doesn't have any NSScrollViews (just two buttons and two text fields).

So... any tips for debugging these types of problems? For example:

  • Is there any way to get a list of ALL of the bindings specified in a nib/xib? (The inability to do this drives me CRAZY!)

  • Is there any way to find out which views or controls were involved in the crash?

  • Is there any way to get more information about what's happening inside monolithic calls like awakeFromNib?

4

1 回答 1

2

您可以将 xib 文件作为源代码(不在 IB 中)打开并搜索"IBBindingConnection"部分。

示例:贾斯汀的搜索方式(见评论):

grep -A 18 -B 1 -H -a -n "IBBindingConnection" /PATH/TO/NIB
于 2012-08-19T00:15:47.730 回答