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

被刻印的时光 ゝ 提交于 2019-12-08 17:34:23

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/6339801/how-to-handle-sigkill-sigabrt-signal-0-exceptions-through-exception-handling-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!