WatchConnectivity not working on device

I have implemented a very simple iOS + WatchOS app project, where I test how one can communicate with the other. I will paste the code below, but the idea is really simple. Each app has one single screen with a button and a label. Tapping the button will send a message to the counterpart indicating the timestamp when the message was generated.

If I run the app on the simulators, everything works fine: messages are sent and received correctly on both the iPhone and the Watch. (You can find a reference gif on imgur.com/ + o1ZQTLp).

The problem occurs when I try to run the same apps on my physical devices. Session is activated successfully but messages aren't sent. If I debug the code, I even see the WCSession.isReachable value set to true.

When debugging the WatchKit app, I see errorHandler is called on the func sendMessage(), and the error states:

WatchConnectivity session on paired device is not reachable.

However, the errorHandler isn't called from the iPhone app.

Details of my devices:
iOS version: 14.0.1
WatchOS version: 7.0.1

I tested this same code before installing the 7.0.1 WatchOS and it worked without any problems, so I wonder if the update introduced some error on the WatchConnectivity framework.

Code on the iPhone app:
Code Block Swift
import UIKit
import WatchConnectivity
class ViewController: UIViewController {
@IBOutlet weak var messageLabel: UILabel!
fileprivate var wcSession: WCSession!
override func viewDidLoad() {
super.viewDidLoad()
wcSession = WCSession.default
wcSession.delegate = self
wcSession.activate()
}
@IBAction func sendMessageAction(_ sender: Any) {
let message = [
"content": "Message sent from iPhone on \(Date())."
]
wcSession.sendMessage(message, replyHandler: nil, errorHandler: { error in
print("Error when sending message: \(error.localizedDescription)")
})
}
}
extension ViewController: WCSessionDelegate {
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
switch activationState {
case .activated:
print("WCSession activated successfully")
case .inactive:
print("Unable to activate the WCSession. Error: \(error?.localizedDescription ?? "--")")
case .notActivated:
print("Unexpected .notActivated state received after trying to activate the WCSession")
@unknown default:
print("Unexpected state received after trying to activate the WCSession")
}
}
func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {
guard let content = message["content"] as? String else { return }
DispatchQueue.main.async {
self.messageLabel.text = content
}
}
func sessionDidBecomeInactive(_ session: WCSession) {
}
func sessionDidDeactivate(_ session: WCSession) {
}
}


Code on the Watch Kit app:
Code Block Swift
import WatchKit
import Foundation
import WatchConnectivity
class InterfaceController: WKInterfaceController {
@IBOutlet weak var messageLabel: WKInterfaceLabel!
fileprivate var wcSession: WCSession!
override func awake(withContext context: Any?) {
wcSession = WCSession.default
wcSession.delegate = self
wcSession.activate()
}
@IBAction func sendMessageAction() {
let message = [
"content": "Message sent from Watch on \(Date())."
]
wcSession.sendMessage(message, replyHandler: nil, errorHandler: { error in
print("Error when sending message: \(error.localizedDescription)")
})
}
}
extension InterfaceController: WCSessionDelegate {
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
switch activationState {
case .activated:
print("WCSession activated successfully")
case .inactive:
print("Unable to activate the WCSession. Error: \(error?.localizedDescription ?? "--")")
case .notActivated:
print("Unexpected .notActivated state received after trying to activate the WCSession")
@unknown default:
print("Unexpected state received after trying to activate the WCSession")
}
}
func session(_ session: WCSession, didReceiveMessage message: [String: Any]) {
guard let content = message["content"] as? String else { return }
messageLabel.setText(content)
}
}


Which devices are you using? I have a similar problem raised by someone running WatchOS 7.0.1 on series 4 but I cannot reproduce the issue on series 3
I am using iPhone Xr and Watch Series 3.
I am also facing a similar issue, i am able to run in the simulator for the first time. But, in the second time it fails with session state 2, i,e. "Session not Activated". Please help.

Thanks in advance
I'm also facing a similar issue.
I have released counter app from last year.
Some users told me a problem about connection between iOS and watch OS.
She is using iPhone8 14.0.1 and AppleWatchSeries3 WatchOS 7.0.3 .
She updated iOS and Watch OS version and the problem happened.

My iPhone and watch(iPhone11 iOS14.0.1, Applewatch Series4 WatchOS7.0.2) have not seen this connection problem.
And also a simulator working fine.

I supplied a testflight debug version that shows connectivity on iOS to the user.
After that, the user told me that hers iOS app showed always unreachable.

Does anyone have a solution?
IMO, WatchSeries3 + watchOS7 is not good combination.

Hi, I've solve this problem. There are two solution for the problem.

Solution1:
Edit scheme then switch debug to release, run the project.

Solution2:
Upgrade your iOS system version to 14.2
Did anybody find a way to fix the issue? I tried to restart the WCsession on both side by calling WCSession.default.activate() but it does not solve it.
Thanks for the help
Hi, I have the same issue. Before this connection worked. After some update it was broken.
I've upgraded Iphone and watch to latest version. 14.4 and 7.3. I changed schema to release and IOS deployment target to latest. It doesn't help. Code is correct. It is similar like at top. It doesn't work.
What happens? Is there any ideas?
The first people have reported this in 2015, I have reported it myself in 2017. They kept telling me "but it works fine on our devices". It's absolutely astonishing how good Apple is at refusing to acknowledge this issue.

Every update breaks the app on user's devices and it takes days of restarting Mac, resetting Watch, switching cables, switching wifis, ... to get a debug session working in Xcode. And as soon as you disconnect the devices the same thing starts all over.

Apple doesn't want you to make watch apps. That's the only reasonable explanation. I can't wait to finally have enough money to open up my Alpaca farm and be done with this stupidity.

I'm also facing the same issue :( I use  iOS system version to 14.6, watch os version to 7.5 In my project, I use WatchConnectivity between phone and watch to communication, When watch send message without reply to phone, every time is OK. But when need reply from phone, it's wrong.

func session(_ session: WCSession, didReceiveMessage message: [String : Any], replyHandler: @escaping ([String : Any]) -> Void) {
//
    replyHandler(reply)
}

when debug the code, I can see this func was called, but watch not receive reply. I try to edit scheme then switch debug to release, run the project. but failed. Is there any ideas?

I am also facing this issue. I can send messages from the watch to the phone just fine.

However, even when the session is activated and isReachable = true, the phone cannot send any kind of communication to watch.

I have tested messages, userInfo transfers, even reply handlers. None of them work going from phone -> watch.

This is a breaking bug for many watch apps - this needs to be fixed ASAP.

Using iOS 14.6 and Watchkit 7.6 had the same issue where watch session was activated but didReceiveMessage was not triggering.

Unpaired and repaired the watch from the phone didn't fix the issue. After Resetting Network Settings on the iPhone the problem was resolved.

I’m also facing the problem when I use TestFlight and install the app on my phone. At first I cannot send message either. While after I restart my phone, the issue has been fixed.

Same issue happens on my friend’s phone and watch.

Any solution?? I am also facing the same issue. The phone is paired and the app is installed but when I try to send a message it gives Watch app is not reachable?

Exactly same with me! When I first install the version, which includes the watch app, the message is not sent. Only after restarting the iPhone it starts working. Tested on multiple iPhones and watches. But can't reproduce it on simulator.

What is the solution? To tell the users to restart the phone when they install the watch app? Ridiculous!!

Same here! iPhone 13 Pro(15.2.1) + Watch 4(8.4.2).

Watch send to iPhone is Ok, iPhone can receive data.But Watch can't receive any data from iPhone without any errors in iPhone.

WatchConnectivity not working on device
 
 
Q