Apple Watch willActivate method not called

I have an issue with my Apple Watch app extension. I don't know why but willActivate method in NotificationController is not being called. I am running it on new WatchOS 8 simulator. Any ideas what could be the problem and how to solve it? Thanks in advance

Hard to say without seeing any code !

Could you post the NotificationController code ?

Yes @Claude31 thanks for your response. Here is NotificationController.swift:

import WatchKit
import SwiftUI
import UserNotifications

class NotificationController: WKUserNotificationHostingController<NotificationView> {
    override var body: NotificationView {
        return NotificationView()
    }

    override func willActivate() {
        // This method is called when watch view controller is about to be visible to user
        super.willActivate()
        print("TEST")
    }

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

    override func didReceive(_ notification: UNNotification) {
        // This method is called when a notification needs to be presented.
        // Implement it if you use a dynamic notification interface.
        // Populate your dynamic notification interface as quickly as possible.
    }
}

And here it is implemented:

import SwiftUI

@main
struct QRableApp: App {
    @SceneBuilder var body: some Scene {
        WindowGroup {
            NavigationView {
                ContentView()
            }
        }
        WKNotificationScene(controller: NotificationController.self, category: "myCategory")
    }
}
Apple Watch willActivate method not called
 
 
Q