Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Handle SIGKILL,SIGABRT, Signal-0 exceptions through Exception Handling in iPhone programming

I have to catch the exception when SIGKILL, SIGABRT, Signal-0 exceptions are raised.

Please Suggest how to handle the above Signals through Exception handling.

Can you please suggest me any sample code to do this?

Thanks in advance.

like image 597
Lakshmi Avatar asked Jun 14 '11 06:06

Lakshmi


2 Answers

You can catch most of the unhandled exceptions by registering an NSUncaughtExceptionHandler in your app delegate.

Similarly you can trap most of the signals using sigaction or signal

As you can see in both above links, you can not catch signals of type SIGKILL and SIGSTOP.

try analyzing your code for any possible reasons that cause these signals.

like image 94
Safeguard747 Avatar answered Oct 19 '22 23:10

Safeguard747


developers with java and C# background are bound to go for exception handling in iOS. Apple has some really good API's to solve the known errors but the program should be made exception free(which i know is difficult). Sigabrt usually occurs when u over release a object and SIGKILL usually occurs when the systems kills your app due to lack of memory. So, i suggest you to read the memory management guide by apple . Also, you can go through this link and this. . Apple has a class defined for exception handling - NSException.

also TRY TO IMPROVE YOUR ACCEPTANCE RATE.

Good luck.

like image 21
A for Alpha Avatar answered Oct 19 '22 23:10

A for Alpha