[Apple Watch Connectivity Demo App] Application context only received on phone

I'm currently learning how to use WatchConnectivity to send data from the iPhone companion app to the Watch extension.

I watched the talk "Introducing Watch Connectivity" from WWDC 2015 and downloaded the example project provided by Apple which demonstrates the different WC capabilities.

For my specific use case I'm particularly interested in updating the application context on the phone and receiving it on the watch. When I launch the demo app on the phone/watch simulator I see a "Update App Context" button in both UIs.

My understanding is that pressing this button for instance on the phone will call the session's delegate callback didReceiveApplicationContext on the watch on the next app launch.

While this works as expected the other way round, meaning pressing the button on the watch first and receiving the application context on the phone on app launch, I can't get it to work with the context being sent from the phone to the watch. The breakpoint in didReceiveApplicationContext is never hit.

I also noticed that when I set a breakpoint in activationDidCompleteWith on the watch the session property paired and watchAppInstalled are set to false:

However both of these properties are true on the phone:

I did not touch any of the code in the demo app, just set breakpoints to understand what's going on.

My question is: Is it possible to update the application context in both directions?

Replies

i recommend you to look at this github example for using different watch connectivity methods, this helped me a lot.

https://github.com/MilanistaDev/WatchConnectivitySampleForSwiftUI/tree/main/WatchConnectivitySampleForSwiftUI%20WatchKit%20Extension