Relaunching watch app with active workout

Hi


I have this watch app with the background processing entitlement enabled which means it can keep running my code even if it enters background. However, if the user decides to explicitly close the app by opening the task manager and swiping the app, and then relaunches it, every view controller is set to their initial state! Now I undrestand that begining with watchOS 5 there's recoverActiveWorkoutSession but that doesn't restore the app to previous state. I was wondering if there's some way to recover the entire app with all UI setups back to last running state?

Replies

What tactics you tried? Which of the states here have you attempted to handle/recover from:

https://developer.apple.com/documentation/watchkit/working_with_the_watchos_app_lifecycle


Show that code, pls...

The common approach is to place in didDeactivate:


https://developer.apple.com/documentation/watchkit/wkinterfacecontroller/1619541-diddeactivate?language=objc


code that saves the current state of the UI and then read that code each time you execute willActivate and reset the UI.