I am writing SDK which will be used by watchOS apps. I need to catch the moment when the app is closed like at image. Or even when app cames from not running state to active state. For now I can only catch transition from inactive to active.
I already try:
_applicationWillEnterForegroundObserver = [notificationCenter addObserverForName:@"UIApplicationWillEnterForegroundNotification" object:NULL queue:NULL usingBlock:^(NSNotification * _Nonnull note) {
[self willEnterForeground];
}];
_applicationDidBecomeActiveObserver = [notificationCenter addObserverForName: @"UIApplicationDidBecomeActiveNotification" object:NULL queue:NULL usingBlock:^(NSNotification * _Nonnull note) {
[self didBecomeActive];
}];
[notificationCenter addObserverForName:@"UIApplicationWillTerminateNotification" object:NULL queue:NULL usingBlock:^(NSNotification * _Nonnull note) {
[self willTerminate];
}];
_applicationWillResignActiveObserver = [notificationCenter addObserverForName:@"UIApplicationWillResignActiveNotification" object:NULL queue:NULL usingBlock:^(NSNotification * _Nonnull note) {
[self willResignActive];
}];
How can I achieve this?