PDA

View Full Version : Error handling and UIAlert




binjaja
Feb 28, 2009, 07:03 PM
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?

Thanks!



dejo
Feb 28, 2009, 07:09 PM
So, basically, you're wanting to notify the user before your app crashes?

gold248
Apr 22, 2010, 04:47 PM
So, basically, you're wanting to notify the user before your app crashes?

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.

fishkorp
Apr 22, 2010, 05:00 PM
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.