English 中文(简体)
Xcode breakpoint [NSExceptionRaise] vs -[NSExceptionRaise]
原标题:

Xcode:Run>Show>Breakpoints

I ve added the obligatory [NSExceptionRaise] and objc_exception_throw yet when I close the Breakpoints window and then return Xcode adds a third breakpoint: -[NSExceptionRaise]. Does this mean [NSExceptionRaise] is wrong and I should delete it? Or are they both helpful? If so in what way are they functionally different?

alt text

最佳回答

The correct breakpoint is:

-[NSException raise]

You re instructing the debugger to break on the -raise method of the NSException class. "[NSExceptionRaise]" is (meaning no disrespect) nonsense. :-)

You don t need both, as far as I know. objc_exception_throw is the "new" way, whereas -[NSException raise] is the "old" way. I believe if you re on Leopard or later, only objc_exception_throw will be called. 10.4 or prior will call -[NSException raise].

问题回答

The newly added breakpoint is to -[NSException raise], which is distinct from [NSExceptionRaise] in that the latter is an object method (NSException being the class, raise being the message). I don t know what the latter is, and I suspect XCode is trying to be intelligent about what you entered v. what it thinks you meant.

You have to preface the method with either a plus or minus character because the debugger uses the headers to locate and define the symbol. Different methods can have the same name but methods prefaced by a "+" are class methods and those prefaced by "-" are instance methods. Without the plus or minus the debugger has no idea what method you wanted.





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签