Sometimes A Dash Of Snark Is OK

Today I stumbled upon a fun error message when doing some iOS development.  I was accidentally calling dateByAddingComponents:toDate:options: on an NSCalendar object and this fun message appeared in my console:

-[__NSCFCalendar dateByAddingComponents:toDate:options:]: date cannot be nil

I mean really, what do you think that operation is supposed to mean with a nil date?

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):

A bit snarky there, Apple, but that's OK. :)

Posted on Aug 22
Written by Wayne Hartman