Post

Replies

Boosts

Views

Activity

Reply to iOS did not update all widgets of an app when the user press a button on a widget
I also want to ask Apple developers to make WidgetKit more user-friendly for external developers. It was always mentioned at all WWDC sessions that WidgetKit is designed to prevent power consumption on iPhone. But why API doesn't allow updating one specific widget? I know for sure that I need to update 1, but I have to call WidgetCenter.shared.reloadAllTimelines(). So if the user has created several widgets of the same kind, I have to update them all, although I need only 1. Have you ever tried to log how many times iOS called widget extension for getTimeline() ? It may call it consecutively several times (3-4) for one widget. This wastes power on iPhone. Why are widgets that are deleted not actually deleted, but continue to exist in the background. And sometimes they can reappear on the home screen. This bug exists since iOS 14. Users periodically report that after installing an application from the appstore, widgets for it are not in the widget list. It can only be fixed by reinstalling! Sometimes users' widgets disappear when updating iOS. And this strange idea with the widget update limit. How many times I can update widget is a secret. Maybe you can make an API to find out how many times a widget can be updated, and we can at least do something with this. Now it's a lottery whether the widget will update at the specified time or not. After all, we are writing programs, not making a roulette. The main thing in my applications is the widget, and after the initial setup, users do not open the application at all, they use the widget. iOS sees that the user does not open the application and reduces the limit on widget updates. Please add an entitlement like for video applications, that this is a widget-oriented application and treats it differently. No API to wake up the main application in the background from the widget when the user pressed the button in the widget. The solution is to pull my server so that it sends a silent push to the application? API URLSessionConfiguration.background for loading data in the background for the widget, in which the documentation says that after receiving the data, pull WidgetCenter.shared.reloadAllTimelines() and this will update all widgets. But it does not always update, but when it wants. Apparently because of (5). But not only that, if the server returns a response very quickly, then the API will not go to the background at all and will not call half of the callbacks, as if it were a normal foreground application. That is, you need to guess to add a delay downloadTask.earliestBeginDate = Date (timeIntervalSinceNow: 2) so that the widget after pressing the button decides that it is still in the background and the download goes the normal way. I made my first widget app Widget Web https://apps.apple.com/app/id1522169352 for iOS 14, and since then all these problems continue to exist. The only useful thing that appeared during this time is Button(intent: AppIntent) in iOS 17. I apologize if I offended anyone, I just want improvements in WidgetKit :) In fact, the fact that the API is strange makes life difficult for everyone and therefore there are fewer competitors, but I still want to do it beautifully, as Steve taught us :)
Nov ’24