Clarification about WKWatchConnectivityRefreshBackgroundTask

66 Views Asked by At

In Apple's sample project SimpleWatchConnectivity there is a comment saying

WKWatchConnectivityRefreshBackgroundTask should be completed – Otherwise they will keep consuming the background executing time and eventually causes an app crash. The timing to complete the tasks is when the current WCSession turns to not .activated or hasContentPending flipped to false (see completeBackgroundTasks), so KVO is set up here to observe the changes if the two properties

My question is: Is this always the case for timing the call on completeBackgroundTasks (KVO on hasContentPending/activation)? Shouldn't I try to defer completeBackgroundTasks until I have done all the work that normally happens when I receive data over WatchConnectivity?

0

There are 0 best solutions below