Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 318381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:33:51+00:00 2026-05-12T08:33:51+00:00

I have one crash in my iPhone application that does throw an NSException. The

  • 0

I have one crash in my iPhone application that does throw an NSException. The crash reports are completely ambiguous in where the error is and what exactly is causing it. Is there a smart way for me to set a top level exception handler somewhere to see what is causing it? I can’t replicate the problem myself, but a few of my beta users certainly can.

What’s a smart way to handle a problem of this nature?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:33:51+00:00Added an answer on May 12, 2026 at 8:33 am

    It seems like you are asking two questions here: how to set a top level exception handler; and how to deal with the issue of determining what the root cause is.

    Catching the exception can be done in a few different ways, but for this the best approach would appear to be to set an exception handler using NSSetUncaughtExceptionHandler.

    When an exception is raised in your app, it is handled by a default exception handler. This handler does nothing more than log a message to the console before the app closes. You can over-ride this by setting you own custom exception handler using the function stated above. The best place to do this would be in the app delegate applicationDidFinishLaunching: method.

    - (void)applicationDidFinishLaunching:(UIApplication *)application
    {
        NSSetUncaughtExceptionHandler(&myExceptionHandler);
    }
    

    Once you’ve set a custom handler, you’ll want to expand on the default output in helping you determine what the cause is.

    void myExceptionHandler(NSException *exception)
    {
        NSArray *stack = [exception callStackReturnAddresses];
        NSLog(@"Stack trace: %@", stack);
    }
    

    Unfortunately compared to OSX the iPhone appears quite limited in respect to producing a nice stack trace. The code above will produce some seemingly junk output; however, you can run this output through the atos tool, and you should be able to generate a useful stack trace from it.

    Another option is to follow the instructions on this article which will help to produce a nice stack trace automatically.

    As this is going out to beta testers you may have to tinker about to get it working for you.

    You say that you’ve not been able to replicate the problem yourself, only your users. In this case you may find this technical note from Apple useful:

    https://developer.apple.com/library/content/technotes/tn2151/_index.html

    UPDATE: While this post still contains useful info, some of the links it contains are dead irreversibly. It is advised to use the info from this alternative post.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

any one have any idea why application crash on this place In code I
I just downloaded the crash reports for one of my iPhone apps from iTunes
have one time consuming step that flattens a bunch of files. basically i'd like
I have one table that has sales records and another table that has additional
i have one database, and it contains some columns. My requirement is that how
I have an iphone application. I am using XCode 3.2.3 and iphone SDK4. Application
In my application i am getting random crash at any location, i have used
I have an iPhone app that's been in development for about 2 weeks. We
This is on the top of one of my crash reports. Is there any
I have an iPhone app where one view, View A, updates another view in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.