【问题标题】:Uncaught exception in appdelegate swift 3appdelegate swift 3中未捕获的异常
【发布时间】:2017-07-27 13:58:51
【问题描述】:

如何在应用程序级别处理所有未处理的异常?

我尝试使用NSSetUncaughtExceptionHandler,它只调用了 NSExceptions。

我想在应用级别处理未捕获的异常,并允许用户通过导航到主页(某些)页面继续使用应用而不会发生任何崩溃。

【问题讨论】:

    标签: ios swift3 exception-handling app-store


    【解决方案1】:

    我建议您在代码中使用 try catch 块。这将有助于防止您的应用程序崩溃。

    do {
        try {
        // do something here
        // if the call fails, the catch block is executed
    }
    } catch {
        //do something when catch block executes.
    }
    

    【讨论】:

      猜你喜欢
      • 2017-03-15
      • 1970-01-01
      • 2017-05-10
      • 2016-12-08
      • 2015-09-10
      • 1970-01-01
      • 1970-01-01
      • 2016-01-23
      • 1970-01-01
      相关资源
      最近更新 更多