Why does reloading a widget at midnight fail? - swift

I have a WidgetKit widget that generates a timeline with 47 entries, spaced at half hour intervals, with a reload policy set to half an hour after the last entry. The effect is the reload should happen just after midnight every day.
The initial load works fine and the widget updates every half an hour through the day. With the debugger attached the reload occurs as expected just after midnight and the widget continues updating. But in TestFlight and app store releases the widget never reloads after midnight.
When I look at the system logs I can see the OS is trying to reload the timeline every few hours after the last entry, but is failing with this error:
Subsystem: com.apple.chrono
Category: timeline.store
[my.bundle.id:my.widget.kind:systemMedium::321.00/148.00/20.20:(null)] reload: failed with error Couldn’t communicate with a helper application.)
I've added logging to the first line of getTimeline(in:completion:), so I can see it isn't being called when the problem occurs.
How can I make my timeline reload after the last entry please?
Tapping on the widget to open the app, interacting with the app and then putting it in the background causes the widget to reload successfully, even though the app isn't calling reloadAllTimelines().
The reload happens successfully when the debugger is attached.
Any help would be massively appreciated. Thanks

Related

How to set remainder countdown by getting values from database in flutter

In this screen I am creating ride, and taking all these information include (Date and Time of ride) from the driver. After creating a ride I am saving all the data into firestore and getting data into next screen. I am also pasting the screenshot of next screen below
I want to show the countdown according to the date & time and when the countdown end, the start button will enable. how can we do it ? Kindly help me
First of all you have to get difference of time. Start countdown timer with that time. Once you get zero you can enable start button based on that condition. You can see this solution.

Way to update user while code is executing?

I'm creating a SwiftUI multiplatform app in XCode and I have a section of my code that hangs. I want to update the user so they know what's happening and are willing to wait. I originally planned to have an alert with text that changed and then planned to have a Text element that updated. In both cases this isn't shown until after the code executes and as such only shows the final message (normally the success done message unless an error made it end sooner).
Is there anyway I can have a visible message to the user through an alert or SwiftUI element that is updated right away and thus will be helpful?
The fact that the alert isn't even shown until after the code executes is bad and incorrect. This suggests that you are doing something lengthy on the main thread, and that is an absolute no-no. You are freezing the interface and you risk the WatchDog process crashing your app before the user's very eyes. If something takes time, do it in the background.

When I am testing a GUI, an element appears and disappears too quickly

I am testing the GUI using the tools of Webdriver.io and mocha. The tests themselves are written in CoffeeScript. Some interface elements are loaded for a long time, and a rotating loading indicator appears. In order to continue the testing process, it is necessary to wait for the data to be fully loaded (that is, to wait until the loading indicator disappears). This process was performed using function (1):
wait_for_page_load = () ->
$('... load indicator selector ...').waitForDisplayed(20000)
$('... load indicator selector ...').waitForDisplayed(20000, true)
In the first line, I expect the moment when the download indicator becomes visible. In the second term I expect the disappearance of the loading indicator.
However, in the process, I was faced with a situation in which the download indicator appears and disappears too quickly. At the same time, I simply do not have time to “catch” the loading indicator, because at that moment, when I expect it to appear, it already disappears. At the same time, an error message is displayed in the console:
element ("... load indicator selector ...") still not displayed after 20000ms
I found a way out of this situation. When a similar problem occurred, I fixed only the disappearance of the loading indicator. This process was performed using function (2):
wait_for_page_load = () ->
$('... load indicator selector ...').waitForDisplayed(20000, true)
It should be noted that with the fast disappearance of the loading indicator, it is also impossible to do without waiting at all - in this case, new data will not have time to load.
However, in some situations, I cannot determine in advance exactly how long the loading indicator will be visible: sometimes it disappears almost immediately, and I cannot track the moment it appears, in these cases I have to use function (2); sometimes it rotates for a long time, and it is possible to track the moment of its appearance using the function (1).
Is it possible to write a universal function that will fix the appearance and disappearance of a graphic element, even if the element appears and disappears very quickly?
So far I have found the following way to solve the problem. In situations where it is necessary to wait for the loading indicator to disappear, I first time out one second, and then wait for the loading indicator to disappear.
utilities.wait_for_page_load = () ->
browser.pause(1000)
$('... селектор индикатора загрузки ...').waitForDisplayed(20000, true)
Thus, if the download indicator appeared and disappeared too quickly, then at the end of the timeout, it will no longer be on the screen, respectively, we automatically waited for the download indicator to disappear. If the download indicator hangs on the screen for a long time, then at the end of the timeout, we simply continue to wait for it to disappear.
The method is not ideal. Its main drawback is an increase in the total test run time. However, the method is universal and allows you to handle both situations described in the question.

Jenkins' homepage loading very slowly

I setup a Jenkins server and created about 1,000 jobs. The problem I have is it takes roughly 5 minutes to load its homepage while takes less than 30 seconds to load other page (for example, configuration page)
What is the reason of this problems? Is there anyway to fix them?
Create a new view with fewer jobs and set that to be your default view.
If you get the Status View plugin, you can add all jobs to it, and filter by status "Failed". This gives you a view that you can call "All Failed" and it does very well as a default view.
Unless, of course, you have 1000 failed jobs..

Reason for 5 sec delay to show an activity on pressing the home button?

I am facing delay of 5 sec to show an Activity after pressing the HOME key. I had gone through some post and found that after pressing the HOME button, android prevents services and broadcast-receivers from calling startActivity for 5 seconds.
Q1. Can anyone please let me know the reason to happening this delay ?
Q2. When I modified the ActivityManagerService::checkAppSwitchAllowedLocked() to always return true, it avoids checking lock and hence Activity gets shown without any delay. Would it be a good solution to avoid delay or it may cause any wrong effect in other ways ?
I know, it's probably too late (half year passed). However, here is the answer
You won't be able to get this permission on not rooted phone, unless your application is signed with the same keys as system. Android has some permissions like that.
Also, you may be interested to check this question. Starting an activity from a service after HOME button pressed without the 5 seconds delay