'How to force a watchdog termination in the foreground?

I received MetricKit reports that my app has a watchdog termination in a particular method. I can't reproduce the bug, so I want to force a watchdog crash to better understand watchdog terminations in general.

I put an infinite loop on the main thread and ran my app on a physical device. I've waited for at least 30 seconds, and iOS doesn't kill my app.

However, if I trigger the infinite loop, and then put my app in the background, iOS will kill the app.

How do I force a watchdog termination in the foreground?

ios


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source