I want to clear my local notification in notification tray. For this to be implemented, I am thinking to use the silent push notification. So I want to confirm when the device receives it and which things I can do with it?
2 Answers
They can be used to inform the application of new content without having the user informed. Instead of displaying a notification alert, the application will be awakened in background (iOS does not automatically launch your app if the user has force-quit it) and application:didReceiveRemoteNotification:fetchCompletionHandler: will be called. You then have the opportunity to process any information transparently for the user :
- Download some content
- Synchronize some elements,
- Inform the user directly within the application when he opens it back
Note that your time is limited to 30s.
To configure silent notifications
To support silent remote notifications, add the remote-notification value to the UIBackgroundModes array in your Info.plist file. To learn more about this array, see UIBackgroundModes.
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
Configuring a Silent Notification
The aps dictionary can also contain the content-available property. The content- available property with a value of 1 lets the remote notification act as a silent notification. When a silent notification arrives, iOS wakes up your app in the background so that you can get new data from your server or do background information processing. Users aren’t told about the new or changed information that results from a silent notification, but they can find out about it the next time they open your app.
For a silent notification, take care to ensure there is no alert, sound, or badge payload in the aps dictionary. If you don’t follow this guidance, the incorrectly-configured notification might be throttled and not delivered to the app in the background, and instead of being silent is displayed to the user

- 103
- 9

- 1,209
- 1
- 8
- 6
-
20Would it wake the app if it was force killed? – Ashraf Tawfeeq Jan 10 '18 at 14:13
-
6Does the user still need to give permission for receiving these notifications? – thijsai Jun 22 '18 at 15:02
-
3If the app is force closed then will iOS relaunch it for a silent push? – Ashok Jun 25 '18 at 12:13
-
4The user does not need to give permission for silent push. They do have to allow the Background Fetch preference though. If the app is force quit by the user a silent push will not launch the app in the background. – quellish Aug 17 '18 at 03:35
-
1How to awake the app if the user swipes up and killed the app. In Whatsapp sender can always receive double tick confirmation from the receiver (IOS). How??? – Shubham1164 Apr 01 '19 at 01:37
-
3Hi i did poc, if app was force killed also, silent push notification wake up it and run for 30s – iosDev May 08 '19 at 17:43
-
how to sent silent push notification into app is terminated? – Ravi Padsala May 16 '19 at 12:56
When you send a silent push notification and if app is suspended then the system wakes up or launches your app and puts it into the background running state before calling the method but if the app is killed by user manually then it will not wakeup.
application:didReceiveRemoteNotification:fetchCompletionHandler:
This method is called when you send a silent push notification and your app has up to 30 seconds of wall-clock time to perform the download or any other kind of operation and call the specified completion handler block. If the handler is not called in time, your app will be suspended.
If you want to send a silent push notification then your notification payload should be like this :
{
"aps" = {
"content-available" : 1,
"sound" : ""
};
// You can add custom key-value pair here...
}

- 722
- 5
- 15
-
2I believe the advice to include `sound : ""` is now obsolete - that was a way to work around a bug in an older version of iOS. – ToolmakerSteve Dec 19 '16 at 23:06
-
so `application:didReceiveRemoteNotification:fetchCompletionHandler` gets called for silent notifications. What gets called for regular push notifications? – mfaani Feb 14 '17 at 15:28
-
1@Honey. Sorry for late responding. Same delegate method will called for normal push notification also till iOS 9. As from iOS 10, we have a new push notification handler methods. You can handle both push notification in below method for iOS 10.. - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler – Arpit Feb 17 '17 at 06:44
-
2@Arpit Your line "if app is suspended or not running, then the system wakes up or launches your app and puts it into the background running state". Suspended is OK, but in not running scenario, i dont think system wakes or launched app. – Rajan Maheshwari Aug 10 '17 at 06:44
-
1
-
2@Arpit `didReceiveNotificationResponse` is not used for silent notifications. Because there is nothing to respond to. It's silent, you never get to know it happened. That's only used if the user taps/interacts with a notification... – mfaani Nov 11 '17 at 20:15
-
1But in Whatsapp, a sender can always receive double tick confirmation irrespectively of the receiver (IOS) is swipe-up killed or in the background. So, it means Whatsapp is not using a silent push because if the app is swiped up killed, IOS don't wake the app for notification. They are using something else??? – Shubham1164 Apr 01 '19 at 01:35
-
@Shubham1164 WhatsApp has integrated VOIP service and uses PushKit framework, so when app receives a silent notification, application will launch in active mode if an app is killed and you will receive call in method. – Arpit May 21 '19 at 17:53
-
@Arpit in iOS 13 Apple does not allow app using VOIP to do anything excep for calling, what Whatsapp and similar app do for this change? – Tiến Nguyễn Hữu May 11 '20 at 01:10