0

In Xcode there is a place to set actions when the interface controller is dismissed in:

   override func didDeactivate() {
    // This method is called when watch view controller is no longer visible
    super.didDeactivate()

}

However, my watchOS app needs to perform an action when the app quits completely i.e. the home screen is visible. Not when the watch is simply lowered and the screen is dimmed because the app is still running as a workout app and is performing actions.

Is there a way to do this?

Mr Big Problem
  • 269
  • 1
  • 3
  • 12

1 Answers1

1

In ExtensionDelegate, you'll find the method applicationWillResignActive.

Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. Use this method to pause ongoing tasks, disable timers, etc.

You can use this method to do what you need.

honcheng
  • 2,014
  • 13
  • 14