How to Restrict App from Moving to Background and Prompt User for Exit Confirmation?

Hello Apple Developer Forum,

I'm working on an iOS app and need to implement a feature where the app asks the user for confirmation before moving to the background. Specifically, when the user tries to send the app to the background, I want to display an alert asking "Are you sure you want to exit?" and based on their response, either allow the app to move to the background or prevent it from doing so.

Could anyone provide a solution or guidance on how to achieve this?

Thanks.

You can't prevent the app from moving to the background.

You can't prevent the app from moving to the background.

That’s true in general, but there are some specific circumstances where this is possible. For example, in a managed environment the device manager can lock the device to a single app. This post, and some of the follow-up posts on that thread, have info about these options.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

How to Restrict App from Moving to Background and Prompt User for Exit Confirmation?
 
 
Q