views:

549

answers:

4

I wonder if is possible display a dialgo when a unexpected error happend in the iPhone (and not quit blindy the app!) and have time to log or send by email the crash...

A: 

No. There is no way to do that. Apple could do it though, provided they put that function in the process manager (Operating System).

Pablo Santa Cruz
+1  A: 

I remember there being a method you could override in your application delegate class that would be called in the event of an unhandled exception. A few days ago someone wrote a blog post where they shipped off the exception information to a web service from that method.

I apologize that I can neither find the name of the method in the UIApplicationDelegate protocol or the blog post I saw the other day. Apple's online documentation seems to be un-searchable at the moment (grrr!) and I cannot remember where I saw that blog post - if I find it, I'll edit this post to include a link to it.

But it may be possible to have some sort of recovery, or at least the ability to store off error information to disk so it can be sent later.

unforgiven3
+4  A: 

I don't know if you can show a dialog, but you can probably do some logging by specifying a top-level exception handler using the function NSSetUncaughtExceptionHandler

Daniel Dickison
+5  A: 

Yes. For starts implement NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler) and then use something like Crash Reporter. Good stuff.

John Fricker