title: Showing an alert in an iPhone top-level exception handler
body: <p>I'm trying to display a UIAlertView in a top-level iPhone exception handler.  The handler function looks like this:</p>
  
  <pre><code>void applicationExceptionHandler(NSException *ex) {
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                        message:[ex reason]
                                                        delegate:nil
                                               cancelButtonTitle:@"OK"
                                               otherButtonTitles:nil];
    [alertView show];
  }
  </code></pre>
  
  <p>I've seen similar code elsewhere (for instance, <a href="https://stackoverflow.com/questions/1128539/">NSSetUncaughtExceptionHandler not catch all errors on iPhone</a>).</p>
  
  <p>If I single-step in the debugger, I can see that the exception handler is called, and I can see the current screen dim as if it's going to display the alert in front of it, but nothing appears.  Outside of the debugger, the app just quits immediately and goes back to the system home screen.</p>
  
  <p>It does work if I trap an error in applicationDidFinishLaunching and display an alert there before returning.  I assume that the alert view never gets a chance to display in the exception handler because the app is terminating (as opposed to sitting there doing nothing if I just bail out of applicationDidFinishLaunching).  Is there a way to make this work?</p>