I have an app, that supports local and push notifications. Those notifications include a url. Once the user opens the notification, the web page for the url should be loaded. This works.
However the same notification can also be received on the watch. When the user selects the notification and hands it off to the phone, the url should also be opened.
I implemented the following method:
public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool
It is called on handoff. Unfortunately the created userActivity
does not contain the notification payload. Instead the userInfo
only includes the notificationIdentifier. It looks like this:
▿ Optional<Dictionary<AnyHashable, Any>>
▿ some : 1 element
▿ 0 : 2 elements
▿ key : AnyHashable("NotificationIdentifier")
- value : "NotificationIdentifier"
- value : 0F99DF81-C721-4A56-850A-13CF74A85547
How can I retrieve the notification payload?