Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8 today widget stops working after a while

Tags:

I've made a today widget for the german ice hockey league DEL.

I'm loading the next games from our server an show them in a tableView. The loading process is started in the proposed method "widgetPerformUpdateWithCompletionHandler". Initially i'm loading some cached data in "viewWillAppear".

Everything works great so far!

Screenshot of the working widget.

But after a while (one day) the widget stops working. When I open the notification center the widget appears normal, but it is never updated again. I have to remove the widget from the notification center and have to add it again. After that the widget works for a day and then again it stops working.

To see what the widget ist doing, I've added a simple white view with a status text above the table view while loading the data in "widgetPerformUpdateWithCompletionHandler" to see if the widget is doing anything. The white view appears when the widget is working. When it is not working the status view doesn't appear. So I think the method "widgetPerformUpdateWithCompletionHandler" isn't called after the widget is active in the notification center for a while.

I've got no clue what causes the widget to stop working. Any ideas?

like image 917
Wilko X Avatar asked Sep 21 '14 16:09

Wilko X


People also ask

Why do widgets stop working?

Check Location Permissions for the App Meaning, that widgets won't be able to detect your location and update relevant information until you open the app. If these apps are important to you and you want the latest information without opening the app, you need to make a setting tweak here.

How do you refresh iPhone widgets?

Tap On The Widget Sometimes all you need to do to update the information display on a widget is to tap on it and open the app. When the app opens, its content will refresh, which should refresh the widget too.

Why wont my widgets show up?

Open “Settings“. Select “Apps” or “Applications“. One some devices, choose “Manage applications“. Select the menu icon or “More” option at the upper-right corner of the screen, then choose “Show system“.


1 Answers

I've got the same problem and I resolved it by calling completionHandler(NCUpdateResultNoData); right after your network request even when the response hasn't been returned. I found that if completion handler is not called the widgetPerformUpdateWithCompletionHandler will no longer get invoked, and therefore there won't be any more updates. Also make sure you call completion handler in all branches after your request call returns.

like image 106
Siyi Meng Avatar answered Oct 25 '22 19:10

Siyi Meng