An easy way to check is to use Show Completions - go to the method name and press Ctrl-Space or in the Editor > Show Completions menu. A window will appear. Look for entries with (nonnull) - they should not be nil . For example:

I pressed Ctrl-Space with the cursor in [NSString stringWithFormat:...] . As you can see, many arguments are marked (nonnull) .
When you explicitly pass nil in the method call, you have already found the problem. If you pass the variable, check if there is nil at this time.
Rainer schwarze
source share