Watch and iPhone simulator connectivity is broken.

I am trying to get iPhone and watch simulator to send message to each other. I am getting this error(s) all the time:

Error Domain=WCErrorDomain Code=7012 "Message reply took too long." UserInfo={NSLocalizedDescription=Message reply took too long., NSLocalizedFailureReason=Reply timeout occurred.}

-[WCSession _onqueue_notifyOfMessageError:messageID:withErrorHandler:] 0F2558A6-6E42-4EF1-9223-FBC5336EE490 errorHandler: YES with WCErrorCodeMessageReplyTimedOut

Is there are some guideline on how to connect them together? Maybe I a missing some step. For clarification, sometimes they do connect but it feels like pure luck. Please help.

Replies

What method are you using to send a message between the devices? If you send a message and expect a reply, you have to send a reply. If you send a message and don't want a reply, you don't need to handle replying, but there are two different methods for this:

// This method is called when a message is sent *and* a reply was requested
func session(_ session: WCSession, didReceiveMessage message: [String: Any], replyHandler: @escaping ([String: Any]) -> Void) {
  // Do something...
  replyHandler(["itWorked": true]) // <-- Send a reply
}

// This method is called when a message is sent and a reply was *not* requested
func session(_ session: WCSession, didReceiveMessage message: [String: Any]) {
  // Do something...
}

You should also confirm the activation state of the session. If it's not activated and not reachable, you can't use interactive messaging.