I want to do some specific action when app is activated because of clicking an remote notification item from Notification Center. Which delegate will give the userinfo?
-- Manoj
I want to do some specific action when app is activated because of clicking an remote notification item from Notification Center. Which delegate will give the userinfo?
-- Manoj
Copyright © 2021 Jogjafile Inc.
I'm going to go ahead and assume you mean the UI notifications.
What you're looking for is NSUserNotification/NSUserNotificationCenter, as opposed to NSNotification/NSNotificationCenter, which are used to send messages to objects within your application.
You can construct an NSUserNotification with the userInfo property containing whatever information you'd like to receive later. You schedule the notification on NSUserNotificationCenter by accessing its
defaultUserNotificationCenter
and then either calling-scheduleNotification:
or-deliverNotification:
with the notification you created earlier. Lastly, the NSUserNotificationCenter has adelegate
property, which you can assign to be whichever object you want to receive the notifications. That object will then have to implement one of the methods on the NSUserNotificationCenterDelegate protocol such as-userNotificationCenter:didDeliverNotification:
.