Our app also contains a Watch Extension. Part of the apps functionality is to start or stop a process on either device and inform its counterpart by sending the event along with the date it occured. We now would also like to use Siri shortcuts with custom intents for this. At the moment we don't have a watch running watchOS 5 so we can only test this in the simulator.
Following Apples SoupChef example app, we managed to get the shortcuts running on both devices performing their task in the background as wanted. However activating a WCSession for sending the message to the other device fails with error
[WC] -[WCXPCManager onqueue_reconnect]_block_invoke error reconnecting to daemon due to NSXPCConnectionInterrupted
being repeatedly called.
Before attempting to send the message to the other device in the IntentHandler's
func handle(intent: OurIntent, completion: @escaping (OurIntentResponse) -> Void)
We are trying to activate the session a the very beginning of the its
func confirm(intent: OurIntent, completion: @escaping (OurIntentResponse) -> Void) {
let _ = Communicator.sharedInstance
// ...
}
Communicator is implemented as a singleton, trying to activate the session in its intit method like so:
if WCSession.isSupported() {
let session = WCSession.default
session.delegate = self
session.activate() // fails with error mentioned above
}
We are aware of the limitaions about available APIs in App Extensions as mentioned in Apple documentation but this seems not be the case here, because we get passed WCSession.isSupported().
Running the shortcuts not in the background but having them open the app would of course solve the problem, but this would make shortcuts pretty useless in our case.
Does anyone know if we miss any prerequisites to use WCSession here or is it simply not possible? Like said before we can only test in the simulator at the moment. Could this be the problem?
Any help is much appreciated