iOS的看门狗(watchdog)机制

作者: Pandakingli | 来源:发表于2018-09-21 22:48 被阅读80次

    为了防止一个应用占用过多的系统资源,苹果设计了一个“看门狗”(watchdog)的机制。在不同的场景下,“看门狗”会监测应用的性能。
    如果超出了该场景所规定的运行时间,“看门狗”就会强制终结这个应用的进程。
    开发者们在crashlog里面,会看到诸如0x8badf00d这样的错误代码。
    异常代码:“0x8badf00d”,即“ate bad food”

    https://blog.csdn.net/jasonblog/article/details/19031517?utm_source=copy
    如果我们的应用程序对一些特定的UI事件(比如启动、挂起、恢复、结束)响应不及时,Watchdog会把我们的应用程序干掉,并生成一份响应的crash报告。

    苹果开发文档原文:

    • The exception code 0x8badf00d indicates that an application has been terminated by iOS because a watchdog timeout occurred. The application took too long to launch, terminate, or respond to system events. One common cause of this is doingsynchronous networking on the main thread.
      Whatever operation is on Thread 0 needs to be moved to a background thread, or processed differently, so that it does not block the main thread.

    苹果开发文档

    相关文章

      网友评论

        本文标题:iOS的看门狗(watchdog)机制

        本文链接:https://www.haomeiwen.com/subject/vwzznftx.html