DispatchSourceTimer Not Firing in Local Push Connectivity Extension When App Is in Foreground and Device Is Locked

Hi,

I’m using a Local Push Connectivity Extension and encountering an issue with DispatchSourceTimer.

In my extension, I create a DispatchSourceTimer that is supposed to fire every 1 second. It works as expected at first. However, when the app is in the foreground and the device is locked, the timer eventually stops firing after 1–3 hours.

The extension process is still alive, and no errors are thrown

Has anyone experienced this behavior? Is this a known limitation for timers inside NEAppPushProvider, or is the extension being deprioritized silently by the system?

Any insights or suggestions would be greatly appreciated. Thanks!

I’m using a Local Push Connectivity Extension and encountering an issue with DispatchSourceTimer. In my extension, I create a DispatchSourceTimer that is supposed to fire every 1 second.

First off, please don't do that. Cumulatively, that adds up to a lot of wasted work and there isn't anything an idle local push extension should need to be doing once ever second. Having said that, I'm not aware of any reason why this wouldn't work.

It works as expected at first. However, when the app is in the foreground and the device is locked, the timer eventually stops firing after 1–3 hours.

Does your app actually need to be in the foreground to trigger this? That's actually quite weird and, if it's actually required, makes me suspect that the issue here is actually something your app is doing that is interferring with you extension. There's no reason that would have mattered to the broader system.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

DispatchSourceTimer Not Firing in Local Push Connectivity Extension When App Is in Foreground and Device Is Locked
 
 
Q