Finally, I got a workaround.
This thread was quite helpful.
https://developer.apple.com/forums/thread/123624
I just set these observer in awake function,
NotificationCenter.default.addObserver(
self,
selector: #selector(self.applicationDidBecomeActive),
name: WKExtension.applicationDidBecomeActiveNotification,
object: nil
)
thus, wrote callback for restore previous state like this.
func applicationDidBecomeActive()
{
if (PlayingRecord.currentHole == self.holeNum) {
self.becomeCurrentPage()
self.updateView()
}
}
I hope this would be someone's help.
Topic:
App & System Services
SubTopic:
General
Tags: