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 8501155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:07:51+00:00 2026-06-11T01:07:51+00:00

I’m trying to understand exceptions a little more. I’ve installed in my AppDelegate an

  • 0

I’m trying to understand exceptions a little more. I’ve installed in my AppDelegate an uncaught exception handler:

// in applicationDidFinishLaunching:
NSSetUncaughtExceptionHandler(&HandleExceptions);
...
void HandleExceptions(NSException *exception) {
    // Save application data on crash
    [appDelegate saveData];
}

So I’m not entirely sure how this works. Say I access an array out of bounds, which throws an exception. Why does this method not get called? Or say there is an assertion exception thrown after inserting or removing rows from a table – how can I save data before the app crashes in those situations?

In general, when the system throws an exception, how can I have the chance to save data before the app crashes? Or does it not work like that? Is the uncaught exception handler only for exceptions that I throw that are not enwrapped in a @catch or @try?

  • 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-06-11T01:07:52+00:00Added an answer on June 11, 2026 at 1:07 am

    Perhaps ‘appDelegate’ is nil when your method is called. I just added this to a viewController:

    void HandleExceptions(NSException *exception) {
        // Save application data on crash
        NSLog(@"YIKES");
    }
    

    then did this:

    NSArray *foo = @[ @1, @2, @3 ];
    NSSetUncaughtExceptionHandler(&HandleExceptions);
    NSLog(@"%@", [foo objectAtIndex:3]);
    

    and got this:

    2012-09-06 13:51:17.474 Searcher[64798:f803] YIKES
    2012-09-06 13:51:17.475 Searcher[64798:f803] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 3 beyond bounds [0 .. 2]'
    *** First throw call stack:
    (0x67f022 0x1749cd6 0x66b644 0x324d 0xbb8a1e 0xb17401 0xb17670 0xb17836 0xc9addd8 0xb1e72a 0x2fcd 0xaef386 0xaf0274 0xaff183 0xaffc38 0xaf3634 0x2260ef5 0x653195 0x5b7ff2 0x5b68da 0x5b5d84 0x5b5c9b 0xaefc65 0xaf1626 0x2dfc 0x2d95
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
I am trying to render a haml file in a javascript response like so:
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm trying to select an H1 element which is the second-child in its group
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.