How can I simulate app being killed in background?

后端 未结 4 1088
小蘑菇
小蘑菇 2021-02-05 01:21

I\'m trying to verify that my app (App1) behaves correctly when it is shut down by the system after it launches another app (App2). Is there any way to simulate or force this be

4条回答
  •  野性不改
    2021-02-05 01:53

    Yes, if your app is in the background already. An app killed by the system while in the background is terminated with no warning-- no app delegate methods are called, no state changes are made-- which is exactly what happens when you do a debugger stop while the app is in the background. (This presupposes that you've already put your app in the background by clicking the home button on the simulator or Cmd-Shift-H)

    (As @Inafziger notes, you can also get the same effect by using the simulator's interface to force quit the running app.)

提交回复
热议问题