I have a widget which retrieves updates from a server at regular intervals throughout the day, but want it to immediately update again if the user actually looks at it. This always worked fine in iOS 8/9... viewWillAppear fired specifically when, well, the view was about to appear.
But in iOS 10, it seems to happen at other times as well. Not sure when. But suddenly I'm getting about 5x as many hits on the update service, which is a paid service, so this is a real problem.
Is there a way, on a Today widget, to be guaranteed that the widget is actually visible? Or, at the very least, that the Today View is actually visible?
Widgets show you current information from your favorite apps at a glance—today's headlines, weather, calendar events, battery levels, and more. You can view widgets in Today View. You can also add widgets to your Home Screen to keep this information at your fingertips.
"Today View" is where the iPhone houses widgets. Turn on your iPhone, and swipe right from the lock screen (or the first page of your home screen). The Today View gives you a quick glimpse at your day, but you can tailor it to house your shortcuts.
I'd bet that the 5x as many hits is because of how users unlock their devices on iOS 10 now. Swiping from the lock screen shows the users widgets instead of unlocking their device. If you're requesting in your viewWillAppear
then every time a users muscle memory tries to unlock the device the old way, by swiping, your widget is sending a server request. You might want to setup a timer for the request, or add a refresh button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With