2 Replies
      Latest reply on Nov 18, 2019 5:16 PM by japd-developer
      pi80223 Level 1 Level 1 (0 points)

        I was following the SwiftUI tutorial series and finished with the watchOS app (https://developer.apple.com/tutorials/swiftui/creating-a-watchos-app). The problem I see now, is that the custom NotificationView provided in the NotificationController.swift source is never properly shown with the circle image, as illustrated in the tutorial step "Create a Custom Notification Interface" step 9 (=final step).

         

        It seems, as if the data of the push notification is not used at all and therefore an empty NotificationView is instantiated. (=title is "Unknown Landmark", no image displayed).

         

        Therefore I've added console logs to all the functions and have found that didReceive is never called.

            override func didReceive(_ notification: UNNotification)

         

        There is an deprecated didReceive function which includes a completion handler, which is getting called and delivers notification data...

            override func didReceive(_ notification: UNNotification, withCompletion completionHandler: @escaping (WKUserNotificationInterfaceType) -> Void)

         

        But as soon as I implement this method myself, the other functions which generate the NotificationView (body) or provide lifecycle information (willActivate,didDeactivate) are not called at anymore...

         

        Is there anybody who has successfully implemented a custom watchOS notification view using SwiftUI?

        I somehow doubt that the tutorial is properly working anywhere...