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?
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
– AlbanianWCSession
is not reachable and I try to open system settings usingUIApplication.shared.open(URL.init(string: UIApplicationOpenSettingsURLString)!, options: [:], completionHandler: nil)
– Isolecithal