开发者

Debugging an Exception in XCode 4

I'm struggling to get to the bottom of an exception thrown as a result of a method call on a AVAudioRecorder instance. I have an Exception Breakpoint set up, but I'm unable to glean 开发者_StackOverflowany useful information from the stack trace. The point at which the exception is thrown is during a call to:

[recorder prepareToRecord];

If I turn breakpoints off the application runs fine seemingly without any negative effects. The recorder functions normally. Just to be clear, the specifics of the situation are not so important. It is more a case of 'What should I be doing in a situation like this to solve the problem?' I can't see any way of learning any more about the problem with the tools at hand. Documentation on ACBaseCodec seems stale and doesn't shed any light on what might cause the exception to be thrown.

Stack trace from Debug Navigator:

Debugging an Exception in XCode 4

Stack trace from individual thread:

Debugging an Exception in XCode 4

Is there any way to know what has caused this exception?


Unfortunately I think AVAudioPlayer and AVAudioRecorder appear to use C++ exceptions as part of their normal processing flow in prepareTo.... So if you enable a break on all exceptions there is no real way to avoid stopping there. You can probably just keep continuing and get through it. Another possible workaround is to only enable Objective-C exceptions as it appears to be throwing C++ exceptions. That is what I did. Sorry it is not an answer, why they made that design decision for prepareTo... is beyond me.


If the program fails when the debugger is active, there might be a race condition in a thread. Also, you might want to try setting NSZombieEnabled to true or running the program in Instruments to see if any memory issues are causing problems. Is the recorder object retained?

I have seen some instances where a program crashed with no debugger running, yet ran normally when the debugger was active, but I have never seen a situation like this.

Is the debugger logging any messages?


Run it through Instruments. There might not be anything wrong with it. If you're not getting any errors, you shouldn't worry about it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜