First, you need to symbolize the crash log using DSYM to understand what is happening. You need to have a DSYM file since the application was created. The DSYM file allows you to cancel a card from these memory addresses back to readable lines of code.
SIGABRT is the signal you receive when you have an unhandled exception, for example, calling [someArray objectAtIndex:2] if the array has only 1 element. Or, most often, an unrecognized selector: [NSArray unsignedIntValue] .
Take a look at this crash log for this question . Note that Foundation call stack libraries are the same as your code, and this is an unrecognized selector.
Your code:
NSNumber *num = foo; if (num) { bar = [num unsignedIntValue]; }
What you did not tell us, but very important, is what is in "foo". How to assign this NSNumber? If this is any object other than NSNumber, then your fault log will look like yours.
If you want to be REALLY defensive in your programming, you can say:
if (num && [num isKindOfClass:[NSNumber class]])
But in fact, regardless of your "foo", you always need to return NSNumber.
makdad
source share