在 使用 Xcode 檢查內存泄露時(cmd+shift+B)運行,出現了一個警告:nil returned from a method that is expected to return a non-null value iOS
原因是返回了一個 不能為空 的對象。
解決方案:使用 abort() 函數;
The abort()
function is marked with __attribute__((noreturn))
, therefore the compiler will not complain about a missing return value.