Why doesn’t stopping an application in iOS simulator trigger applicationWillTerminate:?

前端 未结 2 1800
傲寒
傲寒 2021-01-11 09:24

I have some code in my AppDelegate’s applicationWillTerminate: method but I don’t know how to test if it works. Using Xcode to stop the simulator d

2条回答
  •  长发绾君心
    2021-01-11 10:04

    The simulator doesn't send applicationWillTerminate: because the springboard isn't sending you the kill code (SIGABRT), LLDB is. To trigger those delegate methods, you have to use the Home Button command (⌘+⇧+H), then pull up the multitasking drawer and kill your application from there. Your debugging session will immediately terminate, and the delegate method will fire successfully.

提交回复
热议问题