I want my application to never just crash stupidly. I know that code quality is the root solution for this. But I still need an application to never crash when some unexpected bug happens. Here is code I want to try.
-(void)testException
{
@try
{
NSString* str;
[str release];
}
@catch(NSException* ex)
{
NSLog(@"Bug captured");
}
}
I know this one does not work. Because release
never raise an exception. Here are my questions:
- How to reach this kind of objective, bug will be captured, no crash?
- How do I know which system library will raise exception and so I can write some code and know it works?
Here's what I have read
- a. Exception Programming Topics for Cocoa
- b. Error Handling Programming
Guide For Cocoa
I come from an experienced Microsoft programmer background in which catch exception or unexpected exception always prevent my program from crashing in a very bad environment.
How did you guys/gals (Mac genius programmers) make crash free programs happened? Share your experience.