I'm going crazy with this problem. If you try to do some operation on a NSDecimalNumber and you didn't initialize it, it cause a crash. The main problem is that if you initialize it in a part of your code, but then you use it in another part, you have always need to check is initialization status.
You can init all your NSDecimalNumber in the viewDidLoad or wherever your file start, but I feel that there must be another simpler way. Apple discourage subclassing the system method, so what is the best way to avoid these kind of crashes? Do you really have to always check?
Example:
NSDecimalNumber *x = [NSDecimalNumber zero];
NSDecimalNumber *y;
[x decimalNumberByAdding:y];
This crash because y is not initialized. This seems obvious, but if x is declared at the top of your code and you init it only where you need it the first time, you risk to use it elsewhere before it's initialization.
I'd like something that take ZERO as the default of non initialized NSDecimalNumber(s)