7

I'm receiving the following error when sending any kind of http request from my WatchKit Extension:

WatchKit Extension[6128:479936] [WC] __33-[WCXPCManager onqueue_reconnect]_block_invoke error reconnecting to daemon due to NSXPCConnectionInterrupted

The message is only attempted to be sent if the session is reachable, which it is at this point. However when I inspect the session object I can see that while reachable is true and the activationState is 2 (WCSessionActivationStateActivated), other properties such as paired and watchAppInstalled are actually false.

In fact, the error is just repeatedly sent multiple times a second while I'm using the app in simulator or device. I'm not sure what's going on but I only started receiving this error when using Xcode 8 Beta 3.

App Delegate:

func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: NSError?) {
    if activationState == WCSessionActivationState.activated {
        NSLog("Activated")
    }

    if activationState == WCSessionActivationState.inactive {
        NSLog("Inactive")
    }

    if activationState == WCSessionActivationState.notActivated {
        NSLog("NotActivated")
    }
}

func sessionDidBecomeInactive(_ session: WCSession) {
    NSLog("sessionDidBecomeInactive")
}

func sessionDidDeactivate(_ session: WCSession) {
    NSLog("sessionDidDeactivate")

    // Begin the activation process for the new Apple Watch.
     WCSession.default().activate()
}

Extension Delegate:

func applicationDidFinishLaunching() {
    // Perform any final initialization of your application.

    if (WCSession.isSupported()) {
        let session = WCSession.default()
        session.delegate = self
        session.activate()
        print("activating")
    }

}

func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: NSError?) {
    // ...
}

Interface controller

if WCSession.defaultSession().reachable { // ... }

How can I solve, or at least work around this issue?

Laurel
  • 5,965
  • 14
  • 31
  • 57
Anushk
  • 482
  • 4
  • 20
  • Beta 3 broke a few things. Have you [filed a bug report](https://bugreport.apple.com/) or posted on the [developer forum](https://forums.developer.apple.com/community/beta/watchos-3-beta)? Apple monitors their own site, but an Apple engineer might not see it here. –  Jul 25 '16 at 18:00
  • I actually don't know what's happening here.. If there have been some changes in watchkit implementation or is it really a bug? – Anushk Jul 25 '16 at 18:04
  • I'm experiencing this as well. I get back this multiple times per second while attempting to use WCSession communications between my WatchOS and iOS simulators: `2016-07-28 13:00:42.962283 Watch Extension[75009:2496784] [WC] __33-[WCXPCManager onqueue_reconnect]_block_invoke error reconnecting to daemon due to NSXPCConnectionInterrupted` – Tyler Sheaffer Jul 28 '16 at 20:03
  • Are you experiencing this on actual hardware or just in the simulator? – ccjensen Jul 29 '16 at 05:26
  • On b4, the excessive logging has disappeared for me but I still can't establish communication between iOS and watchOS simulators. – Anushk Aug 03 '16 at 09:17
  • In Xcode 8.1 I get the same error on the simulator, when the `WCSession` is not reachable and I try to open system settings using `UIApplication.shared.open(URL.init(string: UIApplicationOpenSettingsURLString)!, options: [:], completionHandler: nil)` – Reinhard Männer Dec 01 '16 at 14:27

0 Answers0