UpdateApplicationContext Not Receiving updates

Hi community. It's my first time trying WatchConnectivity kit. When I attempt to send ApplicationContext from phone, my debug print indicates that updateApplicationContext is working correctly. However, I'm having trouble receiving it form the paired watch simulator as nothing is shown on that end. Here are the code for the Phone Extension:


    func sendDataToWatch(data: String) {

        state.append(data)

        do {

            NSLog("sent by phone")

            try WCSession.default.updateApplicationContext(["currentstate": state])

        }

        catch {

            print(error)

        }

    }

Here are the code for watch:

func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String: Any]) {

        print("Hello")

        if let getState = applicationContext["currentstate"] as? [String]{

            print("\(getState)")

            self.state = getState[0]

        }

    }

Any suggestion would be appreciated!

Replies

Hello. For me this doesn't work on simulators (I do not have a real device to test).

I tried the official sample app about watch connectivity and it doesn't work either.

Updating App Context from Watch to iPhone works fine, but from iPhone to Watch does not.

I've tried it on Xcode 12.5.1 and on Xcode 13 beta 3.

I am also having this issue with Xcode 13 Beta 5.

Same problem here with Xcode 13 and iOS 15 & watchOS 8 simulators. "updateApplicationContext" is not triggering the watch simulator.

Same issue here :( Has anyone found/heard of workarounds?

  • Honestly, I stoped trying. I focused on other things :(

Add a Comment

I am having same problem on Xcode13.3.1, Monterey 12.2.1, Apple M1 Max updateApplicationContext broken and will not send information to the watch simulator for any series of watch simulator. Impossible to work with watch connectivity without physical devices.

Anyone know a workaround?