Conclusion first
Currently WKWatchConnectivityRefreshBackgroundTask
is only called for sure on a watchOS Simulator when the watchOS extension's WCSession
is in notActivated
state and the extension is not running in foreground (in background or terminated).
In real devices, it won't be called in my tests. But Apple docs says it may. So you shouldn't rely on it won't be called until Apple changes its docs.
WCSession Cores
For WCSession
, when it is activated
, you can transfer userInfo, and when the counterpart is active, it can get the userInfo. The counterpart won't need to be in foreground to be activated, it can be in a high priority background.
Testing Results
Here are my testing results.
WCSession
notActivated
?
How to make - Using Xcode terminate your watchOS Extension. Xcode will send a kill signal to your WKExtension.
- Or don't run
WCSession.activate()
in your code on watchOS Extension side. AsWCSession
isnotActivated
by default.