对意外错误做出反应

时间:2015-12-01 23:08:55

标签: ios swift error-handling runtime-error

如何对iOS上的意外错误做出反应?例如:

func foo(a: Int, _ b: Int) {
  print(a / b)
}
//oops, this produces a divide by zero error.  How can I react to this
//unexpected error so I can report it to a remote server.
foo(1, 0)

0 个答案:

没有答案