According to the Technical Q&A QA1561 any way of exiting the app is not recommended. The appropriate way is to allow the user to exit the app on their own, without forcing exit or aborting the app's execution.
However, the Microsoft Teams iOS App somehow manages not only to avoid the crash but gracefully exit with animation, similar to pressing the "Home" button on the device.
Video recording or programmatic exit in the MS Teams iOS app
Please note, that no home button has been pressed in the aforementioned example. The app performed animated exit programmatically
How to reproduce this behavior on your device:
@IBAction func minimizeOrKillApp(){
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil)
//Comment if you want to minimise app
Timer.scheduledTimer(withTimeInterval: 0.2, repeats: false) { (timer) in
exit(0)
}
}
It is not recommended and your app will be rejected😃. We all are the developers and We know to how to approve it from reviewer team