37305

iOS Silent Push Notification not delivered after device reboot

<h3>Question</h3>

While testing the delivery of silent notifications (one which has "content-available": 1 in the payload) to my app I noticed that, after device is rebooted notifications are not delivered. Sending the same payload works if the app is running in background or foreground but, after device is rebooted, I do not receive the didReceiveRemoteNotification: callback in AppDelegate .

This happens both on iOS 13 and iOS 12


<h3>Answer1:</h3>
<h3>In short:</h3>

Your notification was probably delayed by the system and will be delivered after some minutes. You can use the Console.app to filter system logs and try to figure out what's happening under the scenes.

<h3>More details:</h3>

After several attempts I got some insight on the delivery mechanism of the operating system which can help understanding what's happening under the scene.

By using the Console.app on macOS, selecting your attached device and filtering logs of a process named "dasd" which contains your bundle identifier (type process:dasd any:YOUR_BUNDLE_ID ) I figured out that the system actually receives the remote silent notification but cancels the attempt to awake my app.

default 15:37:29.955974+0200 dasd Submitted Activity: com.apple.pushLaunch.YOUR_BUNDLE_ID:7BAB0E at priority 5 <private> default 15:37:29.958436+0200 dasd Adding a launch request (<private>) for application <private> by activity <private> default 15:37:29.958611+0200 dasd Launch requests for <private>: (null) default 15:37:29.972714+0200 dasd com.apple.pushLaunch.YOUR_BUNDLE_ID:7BAB0E:[ {name: ThunderingHerdPolicy, policyWeight: 1.000, response: {Decision: Must Not Proceed, Score: 0.00, Rationale: [{timeSinceThunderingHerdTriggerEvent < 300}]}} ], FinalDecision: Must Not Proceed} default 15:37:33.505325+0200 dasd Submitted Activity: com.apple.pushLaunch.YOUR_BUNDLE_ID:B3D6C8 at priority 5 <private> default 15:37:33.509388+0200 dasd Adding a launch request (<private>) for application <private> by activity <private> default 15:37:33.509515+0200 dasd Launch requests for <private>: <private> default 15:37:33.509778+0200 dasd Daemon Canceling Activities: {( com.apple.pushLaunch.YOUR_BUNDLE_ID:7BAB0E )} default 15:37:33.510334+0200 dasd CANCELED: com.apple.pushLaunch.YOUR_BUNDLE_ID:7BAB0E at priority 5 <private>! default 15:37:33.510514+0200 dasd Removing a launch request for application <private> by activity <private> default 15:37:33.510693+0200 dasd Don't have <private> for type 0 default 15:37:33.510865+0200 dasd Don't have <private> for type 1 error 15:37:33.511162+0200 dasd Activity <private> not tracked as being started, ignoring it

More precisely I found out that two policies are enforced by the operating system:

<ul><li>a BootTimePolicy which requires at least 120 seconds to elapse after boot before delivering notifications</li> </ul>{name: BootTimePolicy, policyWeight: 0.010, response: {Decision: Must Not Proceed, Score: 0.00, Rationale: [{[Minimum seconds after boot]: Required:120.00, Observed:103.62},]}} <ul><li>a ThunderingHerdPolicy which, in this case, requires at least 300 seconds to elapse after a misterious "ThunderingHerd" event</li> </ul> {name: ThunderingHerdPolicy, policyWeight: 1.000, response: {Decision: Must Not Proceed, Score: 0.00, Rationale: [{timeSinceThunderingHerdTriggerEvent < 300}]}}], FinalDecision: Must Not Proceed}

After that, following the logs flow I noticed that the system keeps on evaluating this ThunderingHerdPolicy several times and, after 300 seconds, the silent notification was effectively delivered to my app!

Recommend

  • Problem in logging into website using Jsoup
  • iOS Silent Push Notification not delivered after device reboot
  • MySQL Resource id #
  • Eclipse C macro automatic formatting
  • Streaming bytes via HTTP PUT with JAX-RS
  • Way to draw NSString on a curved path?
  • Rails Model inheritance in forms
  • jQuery Validate Remote Error Message
  • How do I put booleans into a mysql database with prepared statements?
  • Cannot connect to alternate Mongo DB in Meteor App
  • Designing a database that handles inventory tracking with product variations
  • libgit2 with libssh2 and libopenssl on windows
  • Retrieving images from SQL Server 2008 and displying it in a image controller of asp.net
  • Select with two counts on same column
  • uploading video to googlevideo.com
  • Inheritance and lazy loading in NHibernate
  • Move the coupon field to the cart totals
  • Show Spinner When Teble Row Click
  • Mule:Magento connector: get-product operation bug
  • How To Separate Strings For UIScrollView/UITextView based on the size of the frame
  • Why does IntStream.range(0, 100000).parallel.foreach take longer then normal for loop
  • how to change the black color to Red with opencv python
  • remove date from DateTimePicker for Compact Framework
  • Is there a .NET method equivalent to NETWORKDAYS in Excel?
  • How to close a WebView with double-click?
  • Delete a ListItem by clicking the ImageView within the ListItem
  • Adding native code to an existing Worklight hybrid app
  • Issue with Terrain Collision using Three.js
  • Swift manually rotate view controller
  • Splitting ReportLab table across PDF page (side by side)?
  • Ajax call on Multiple selection in Select box
  • java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/SpringDispatcher-ser
  • How to use Streams api peek() function and make it work?
  • `$http:badreq Bad Request Configuration` - from angular post method, what is wrong here?
  • How to decleare char *const argv[] in swift [duplicate]
  • How to get rgb from transparent pixel in js
  • Sql - ON DUPLICATE KEY UPDATE
  • WPF custom control and direct content support