Error handling and UIAlert

Discussion in 'iOS Programming' started by binjaja, Feb 28, 2009.

  1. macrumors newbie

    Nov 13, 2008
    How do you alert the user that you are about to exit the app? I've been struggling with this for some time... When I am many levels deep in the code and get an unrecoverable error, (file system problem, database problem) I want to alert the user using UIAlert , then exit. The problem is that UIAlert only displays at the beginning of the next run cycle, so in order to get there , I need to cleanly return from many levels deep in the code. I don't want to do that...

    I tried using [self.view presentError], which will go up the chain to the top of the app , then show an alert, however I don't think its supported on the iPhone because I couldn't get it compiled.

    Any suggestions? Is there something like CFRunLoopStop that won't STOP the run loop, it will just go to the top of it? Is there something that will return,return,return,return up through my methods till I get to the top of the run loop so the alert will show? Or do I have to return all the way up the chain when I find an error?

  2. Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    So, basically, you're wanting to notify the user before your app crashes?
  3. macrumors newbie

    Apr 22, 2010
    Is there a better way to debug applications? I'm working on a port of an application from another platform to the iPhone. It consists of over 450 files and 5MB of code. When this app asserts, I'd like to be able to give our QA Department useful information about where exactly in the code the assertion failed.

    I'm totally new to mac programming. If you have any suggestions on how to do what the original poster was asking, please speak up.
  4. macrumors demi-god


    Apr 10, 2006
    Ellicott City, MD
    Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.4 Mobile/7D11 Safari/531.21.10)

    You can pull the crash logs off the phone.

Share This Page