Switch from background to foreground programmatically

I have an application that runs in background after pressing the "Home" button.

I wish to automatically restore back in foreground mode the app after a local event (ie a timer).


How can I switch my app from background to foreground and eventually from forground to bakground in a programmatic mode ?

Thanks in advance for any help.

Replies

You can't, plain and simple.

The best you can do is generate a notification that the user would be able to ignore but which would bring you app back to the foreground if the user chose the interactive response.

Where can I find a simple examle ?


Thanks

You can post notifications using two different APIs:

  • UILocalNotification, which has been around since iOS 4

  • User Notification framework, which is new in iOS 10

You recommend you look at the documentation for those APIs and then post back if you have specific questions.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"