Re: Assert trigged in -[NSEvent eventNumber]
Re: Assert trigged in -[NSEvent eventNumber]
- Subject: Re: Assert trigged in -[NSEvent eventNumber]
- From: Jens Alfke <email@hidden>
- Date: Mon, 23 Jun 2008 10:24:58 -0700
On 23 Jun '08, at 5:21 AM, Mattias Arrelid wrote:
The error claim that an
assert has failed in -[NSEvent eventNumber] - and each time this
occured, our custom mouse tracking seemed to stop working.
Unfortunately, I do not have access to the log at the moment. What
would be the right™ thing to do here? Since it isn't an exception, I
cannot catch it myself, so I'm fumbling in the dark at the moment.
Assertion failures *are* NSExceptions, and you can use an @catch block
to intercept them.
However, they also indicate an error in your code, so of course you
should try to fix the bug instead of just ignoring the exception. The
best thing to do is to use Xcode's breakpoints window to add a
breakpoint at "objc_exception_throw" (on Leopard) or
"NSRaiseError" (Tiger), and run your code with breakpoints on until
you can get the exception to occur. Then you can look at the stack and
your variables to figure out what's wrong.
If it's one of those unpleasant bugs that only manifests when no one's
looking for it, you can build some debugging features into the app. My
MYUtilities library[1] has a module called ExceptionUtils[2] for use
in displaying backtraces of exceptions. You can use this to have any
uncaught exception pop up an alert panel containing the full backtrace.
—Jens
[1] http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/ ... use the
"zip" link at the top to download
[2] http://mooseyard.com/hg/hgwebdir.cgi/MYUtilities/file/tip/ExceptionUtils.h_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden