Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling hidden errors Objective C

We have all come across obvious errors and complicated errors. I am currently programming an iPad app. A couple of times I have come across errors that are really quite hard to track down. Even when using

NSUncaughtExceptionHandler();

and a variety of other error handling calls. My question is when you have tried all the obvious techniques to track down an error, and you app is crashing for no apparent reason. Hows best to proceed and what are the best error handling techniques?

console output

Current language:  auto; currently objective-c
kill
error while killing target (killing anyway): warning: error on line 2184 of    "/SourceCache/gdb/gdb-1708/src/gdb/macosx/macosx-nat-inferior.c" in function "void macosx_kill_inferior_safe()": (os/kern) failure (0x5x)
quit
Program ended with exit code: 0
like image 807
geminiCoder Avatar asked Sep 02 '11 10:09

geminiCoder


2 Answers

That is the debugger crashing / erring, not your app. Nothing you can do in the app cam catch that.

However, it is likely that something in your app has gone off the rails, causing the debugger to freak out.

You might be corrupting or running out of memory, for example.

Also, up date to the latest tools as the debugger will typically have bug fixes that make it behave better in the face of catastrophic inferior failure.

like image 86
bbum Avatar answered Nov 17 '22 01:11

bbum


I had the same thing, and also no indication that there was a specific line causing the problem - eventually I found that I had the following code in one of my .h files:

@property (nonatomic, copy) IBOutlet UILabel *dateLabel;

I changed 'copy' to 'weak' and problem solved. changed back to recheck and it was definitely the culprit.

like image 28
Sean Avatar answered Nov 17 '22 00:11

Sean