Well, in my opinion, this should trigger a warning, but I could not understand to get it.
Which may be useful using Product > Analyze
to run the CLANG Static Analyzer. This should give the following hint:
Null is returned from a method that should return a non-zero value
Another note is the setting CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
, which is called Incorrect Uses of Nullable values
in the Apple LLVM 7.1 - Warnings - All languages
section in the build settings.
This parameter will not result in a warning about incorrect return values, but when using the method with incorrect parameters, a warning is displayed (for example, nil for abnormal parameters).
This answer applies to Xcode version 7.3.1 (7D1014)
source share