caiyue1993/IceCream

Pull inside a SwiftUI widget: does it work for you?

开放

#237 创建于 2021年5月31日

 (0 条评论) (1 个反应) (0 位负责人)Swift (259 个派生)user submission
good first issue

仓库指标

星标
 (2,005 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

My app has a couple of Today Widget extensions in which I’m successfully invoking mySyncEngine.pull() method, resulting in an awesome user experience, since any remote updates are immediately available for the user.

I’m now working on a new version of such widgets using SwiftUI. I’ve tried a similar approach inside my provider’s getTimeline() and/or getSnapshot() methods, however it doesn’t seem to have any effect: no updates are ever pulled. The widget’s entitlements look the same as the old widgets. The debugger doesn’t show any error messages: but I’m not sure I should trust on that lack of output.

The only good news so far is that, when “Background App Refresh” is enabled on the device, remote updates received via silent push notifications will indeed update my local database and the widget will also reflect such updates on its next snapshot. But relying on that setting alone is not good news for me, since many users disable it and it’s also not available on macOS (while my app has a Mac Catalyst version).

Has anyone been able to pull this feat (pun intended)? 😅 Any tips or suggestions are much appreciated.

贡献者指南