-1

I made a "todo" app, using core data, and want to extend it to apple watch. The main problem is that when I run the simulator, the watch seems to be not connected with iPhone.

I tried to import WatchConnectivity, use WCSession, delegate, and they are all not working because the watch is not getting connected with the phone in the first place.

  • I am using SwiftUI, but not storyboard
Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52

2 Answers2

0

One of the reasons why the WCSession might not be working is because you didn't pair the watch and the iPhone simulators.

If you go to Window > Devices and Simulators > Simulators it will let you also add a watch to each iPhone.

enter image description here enter image description here

Call it a specific name so it's easy to find it to run on it.

You can also open both devices and go in the Watch app on the iPhone, so you can check that they are actually synced.

enter image description here

Usually when you run the app on that specific watch simulator it will automatically install the app also on the iPhone and it will say something like this:

enter image description here

Be also sure to activate the session on both watch and iPhone with:

let session = WCSession.default

if WCSession.isSupported() {
            session.delegate = self
            session.activate()
     }

This article covers some of the most common errors with connectivity, maybe it might help: https://medium.com/swlh/how-to-use-watchconnectivity-to-send-data-from-phone-to-watch-plus-most-common-errors-793d41976618

jadebowl
  • 11
  • 4
0

If you want to run the app on "watch simulator" then please try to delete the simulators at the path "~/Library/Developer/CoreSimulator" and download again the simulator with the paired watch.

If trying to run on real watch device, then it should automatically launch the watch app if watch is paired and synched with the help of option in settings as "View app on Apple Watch" set TRUE.