在 Combine 中使用 breakpointOnError()

Using breakpointOnError() in Combine

Combine 中有多种方法,例如...

如果您忘记删除这些并且它进入发布版本会怎样?编译器是否因为构建上有发布标志而将它们传递过来,或者我是否会冒异常风险?

来自Apple Doc

breakpointOnError()

When the upstream publisher fails with an error, this publisher raises the SIGTRAP signal, which stops the process in the debugger. Otherwise, this publisher passes through values and completions as-is.

是的,这会停止调试器中的进程。

编辑

SIGTRAP 停止调试器中的进程,如果未附加调试器,应用程序将崩溃,尽管这不是预期的行为。

SIGTRAP,由 breakpointOnError 生成,在未附加到调试器时会导致进程崩溃。因此,只要未附加调试器,应用程序就会崩溃 - 无论是在调试还是生产版本中。

我已提交反馈 #FB9626473。