• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Exception Location
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exception Location


  • Subject: Re: Exception Location
  • From: Ken Thomases <email@hidden>
  • Date: Tue, 21 Dec 2010 23:46:54 -0600

On Dec 21, 2010, at 11:25 PM, Richard Somers wrote:

> The following exception message that is being sent by the frameworks: -[NSCFArray objectAtIndex:]: index (x) beyond bounds (y)
>
> The method 'objectAtIndex:' is called in many location within the code base but the console message gives no indication where the error occurred.
>
> The error is actually occurring on users test machine that does not have Xcode installed.
>
> Is it possible somehow to get the console message to indicated where in the code the error is occurring?

If you can deliver the user a different build of your app, you can use NSExceptionHandler to log more detailed information about the exception.  See that class's documentation, including the conceptual guide, for more information.

Another approach is to use DTrace.  All thrown/raised exceptions from Objective-C go through the objc_exception_throw function.  So, a DTrace one-liner like the following would print a stack trace for them:

sudo dtrace -n 'pid$target::objc_exception_throw:entry {ustack();}' -p <pid of app process>

(Note that this may trace exceptions in addition to the one you're seeing logged, if something is using exceptions internally.)

Regards,
Ken

_______________________________________________

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

References: 
 >Exception Location (From: Richard Somers <email@hidden>)

  • Prev by Date: Re: Strange error solved by turning off "Non-contiguous Layout"
  • Next by Date: Re: CALayer and pixel alignment
  • Previous by thread: Exception Location
  • Next by thread: hacked email account
  • Index(es):
    • Date
    • Thread