0

I have found a great description of the process for refreshing both the watchapp UI and its complications here. That works for me, even though sometimes the UI is only updated when I actually bring the app to the foreground (but that's another issue).

what I have been doing so far is this:

1 - I schedule a background refresh;

2 - When the background refresh task is called, I schedule a background downloadTask;

3 - After completion, the downloadTask call its delegate method (didFinishDownloadingTo), where I call another method to update the UI, reload my complications with new data and to schedule a snapshot refresh and another background refresh.

This is almost working fine (with the ocasional problem I mentioned above). But I put my watch on flight mode sometimes. What happens here is that the error delegate method is called, and so I schedule another app refresh for about 1 hour. If still in flight mode, it will request another refresh in one hour, and so on.

The problem with this approach is that when I turn off the flight mode, the app takes a long time to update its UI, depending on when the next update is scheduled.

Can someone suggest a better approach to get new data as soon as one gets internet connectivity back?

Community
  • 1
  • 1
francisaugusto
  • 1,077
  • 1
  • 12
  • 29

1 Answers1

0

At the moment (watchOS 3.2) there is no framework in watchOS that could tell you when the device connects to the internet. However, you could leverage the Reachability framework in your iOS app and use the WatchConnectivity framework to signal your Watch app when it can refresh its UI.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116