It is received fine when the watch app is in the foreground.
Code sample:
import Foundation
import PushKit
final class PushNotificationProvider: NSObject {
let registry = PKPushRegistry(queue: nil)
override init() {
super.init()
registry.delegate = self
registry.desiredPushTypes = [.complication]
}
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
print("token recieved")
}
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void) {
print("push recieved")
completion()
}
}
Watch app:
import SwiftUI
@main
struct XX_Watch_App: App {
@WKApplicationDelegateAdaptor var appDelegate: XXWearableAppDelegate
private let push = PushNotificationProvider()
var body: some Scene {
WindowGroup {
AppView(...)
}
}
}