Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which method will be triggered when the notification received on iPhone(not after the notification is tapped and opened)?

I’m now using didReceiveRemoteNotification to get the payload of the notification pushed from Parse, however, it is only triggered when the notification is tapped and opened.

What I’m trying to do is start an alarm to remind the user that a notification has arrived, so I guess didReceiveRemoteNotification is not what I’m looking for. Which method should I look into for this purpose?

Thank you!

like image 298
Alison Avatar asked Sep 03 '25 05:09

Alison


1 Answers

Words from The WWDC 2014 Whats New in iOS Notifications

Local and push notifications let background or inactive apps notify users that an event of interest has occurred, or that an app has new information for them.

The WWDC 2013 Whats New With Multitasking tells us how to get this work.

• add UIBackgroundModes : remote-notification in info.plist

enter image description here

• add `content-available: 1 in your Payload while sending from server

enter image description here

• lets iOS handle it to open your app for background mode

enter image description here

For iOS 10 and above you have to switch ON the Background Modes from your Target -> Under Capabilities and check mark the required fields.

enter image description here

Now you can set your alarm as you want. you may set a scheduled local notification until user interact with app

like image 158
M Zubair Shamshad Avatar answered Sep 04 '25 23:09

M Zubair Shamshad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!