NSCalendar warning message never fails to annoy me
This warning message from the depths of Foundation never fails to annoy me:
MulleCalendarReloaded[1197:c07] *** -[__NSCFCalendar components:fromDate:toDate:options:]: toDate cannot be nil I mean really, what do you think that operation is supposed to mean with a nil toDate? An exception has been avoided for now. A few of these errors are going to be reported with this complaint, then further violations will simply silently do whatever random thing results from the nil. Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
Some random newb coder at Apple picked unfailingly the worst solution out of the possible four choices:
- Just extract your 0.0 NSTimeInterval from the NSDate nil and get on with it. This is what I'd expect, this being Objective-C after all.
- Return nil. That's the way to indicate that something went wrong, without raising an exception.
- Raise. If you feel really strongly about it.
- Be as vague and whiny as possible about it. Avoid making a decision.