Instance Method

applicationWillResignActive()

Tells the delegate that the Watch app is about to be deactivated.

Declaration

optional func applicationWillResignActive()

Discussion

WatchKit calls this method after your app launches and before it exits. Use this method to pause any active tasks. For example, you could use it to stop any active timers. An app in the inactive state should do minimal work while it waits to transition to the active or not running state.

If your app has unsaved user data, you can save it here to ensure that it is not lost. However, it is recommended that you save user data at appropriate points throughout the execution of your app, usually in response to user actions. Do not rely on specific app state transitions to save all of your app’s critical data.

See Also

Monitoring State Changes

func applicationDidFinishLaunching()

Tells the delegate that the launch process is almost done and the extension is almost ready to run.

func applicationDidBecomeActive()

Tells the delegate that the Watch app is now visible and processing events.

func applicationWillEnterForeground()

Tells the delegate that the app is about to transition from the background to the foreground.

func applicationDidEnterBackground()

Tells the delegate that the app has transitioned from the foreground to the background.

func deviceOrientationDidChange()

Tells the delegate that the device's orientation has changed.

func handle(Set<WKRefreshBackgroundTask>)

Tells the delegate that the app has received one or more background tasks.