App “failed to resume in time” and hangs

♀尐吖头ヾ 提交于 2019-11-28 22:05:36

Whenever you see a 0x8badf00d that means you are getting killed by the launch watchdog. Your app is taking too long to return from -applicationDidFinishLaunching.... Normal Core Data related causes to this are:

  1. Trying to import data in the -applicationDidFinishLaunching...
  2. Trying to perform a migration from -applicationDidFinishLaunching...

To solve this you need to change your start up. The creating of the Core Data stack should never be done in the -applicationDidFinishLaunching.... Instead let the -applicationDidFinishLaunching... finish and then stand up the Core Data stack. If a migration is needed (you can check this pretty easily) then present the user with a UI informing them of the delay and then kick it off.

In either case you need to return from the -applicationDidFinishLaunching... as fast as possible, you should only be creating UI elements in this method; you should not be accessing Core Data at this point.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!