Problem with Chapter 4 tutorial

Continuing the discussion from Errata for watchOS With SwiftUI by Tutorials 1st Edition:

I am having a problem in Chapter 4’s tutorial. I can’t get the Purchase Movie Tickets app to update either the device or watch simulator.

I downgrade Xcode to 13.4.1 to be able to follow the tutorial. I have paired a iPhone 13 Pro Max with iOS 15.5 with an Apple Watch series 7 45mm watchOS 8.5 and have to other apps running on this combination that are running fine:

Implementing Two-Way Communication Using Watch Connectivity - Implementing Two-Way Communication Using Watch Connectivity | Apple Developer Documentation
SwiftUI Watch Connectivity — in 4 steps by Chris Gaafary - SwiftUI Watch Connectivity — in 4 steps | by Chris Gaafary | Medium

I even tried using the completed code included in the download to rule out my code. Are you aware of any bugs with the example? Is anyone else having trouble? What am I missing?

1 Like

Thank you @jburkke for your question and active participation in the forum! We appreciate your engagement. Rest assured, we will handle your question shortly. Stay tuned! @jellodiil

@jburkke I just pushed an update to the final project for chapter 4. I verified both apps updated when running from Xcode 14.3.1. You can download the final project and check your code against it to see if you missed anything. There are a lot of steps and it’s easy to forget something.

In one case on hardware, it did take 90 seconds for an update to get to the other device. Other times it happened almost instantly, so it doesn’t seem to be caused by the example project code.

Hope this helps!

I had a similar problem: It seemed like neither was updating the other. I encountered one issue, which was (seemingly) on the watchOS side: In Connectivity.init() I was using:

WCSession.default.delegate = self

The correct code should be:

WCSession.default.delegate = self

The interesting thing was I only got a debug error from watchOS - apparently iOS doesn’t have a problem with this, but the error for the watchOS side of things prevented the WCSession call to activate() because there was no delegate assigned. Even though the iPhone app was sending to the watch app, the watch app never received anything; and because the watch app didn’t have an activated WCSession it couldn’t send anything.

Thanks everyone for your input here. I will be closing this now.