Correct way of setting up Watch Connectivity session?

117 views Asked by At

I have an iOS app with a Watch companion-app (or the other way around perhaps?). When I'm debugging the iOS-app without running the Watch app I get the following debug message: [WC] WCSession counterpart app not installed

My setup code for a WC-session in the iOS-app goes something like this:

    func startConnectivity() {
        guard WCSession.isSupported() else { return }
        
        let session = WCSession.default
        self.session = session
        session.delegate = self
  
        //if session.isPaired && session.isWatchAppInstalled {
            session.activate()
        //}
    }

I have tried removing the commented if-statement, and I no longer get the error, however the app won't communicate with the Watch when the app running on the Watch. It seems session.isPaired and session.isWatchAppInstalled is always false. What am I doing wrong here? Can I ignore the message and always activate the session, or will the app be unstable or get rejected from App Store? The app I'm doing does not require an Apple Watch, but will have additional features when the Apple Watch is installed.

0

There are 0 answers