How can I simulate app being killed in background?

iOS 14.5 and Later

Enable SettingsDeveloperFast App Termination on the device:

screenshot of Settings - Developer - Fast App Termination

This will terminate, instead of suspend, your app when they’re backgrounded. This is useful primarily for testing state restoration logic.


iOS 14.4 and Earlier

As the other answers note, you can immediately end your app by force-quitting it or by stopping the debugger. Your app will get no warning in those cases.

If you’re looking to test your applicationWillTerminate methods, set UIApplicationExitsOnSuspend to YES in your .plist and then switch apps or press the home button. Make sure you set the key to a Boolean, not the string “YES”.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)