Generally speaking, if your method requires that a parameter is not nil, you'd better bail out as soon as possible in case it is.
With this in mind
NSParameterAssert(item)
is a good practice. It is thoroughly explained here, but the quick summary is that it throws an NSInternalInconsistencyException
in case the assertion is not satisfied.
Note that by default the NSParameterAssert
macro (as well as all the others NSAssert
-like macros) is removed in release builds, unless you undefine NS_BLOCK_ASSERTIONS
.
More on the subject is explained here.