Post

Replies

Boosts

Views

Activity

Watch: WCSession is NOT reachable
** Facing issue for watch unreachable, I have tried for real device as well simulator** if let controller = window?.rootViewController as? FlutterViewController { let channel = FlutterMethodChannel( name: "watchconnectivity", binaryMessenger: controller.binaryMessenger) channel.setMethodCallHandler({ [weak self] (call, result) in switch call.method { case "sendToWatch": guard let watchSession = self?.session else { print("❌ Watch session not initialized") result(false) return } guard watchSession.isPaired else { print("❌ Watch not paired") result(false) return } guard watchSession.isReachable else { print("❌") print("isPaired: \(watchSession.isPaired)") print("isWatchAppInstalled: \(watchSession.isWatchAppInstalled)") print("isComplicationEnabled: \(watchSession.isComplicationEnabled)") result(false) return } guard let arguments = call.arguments as? [String: Any] else { print("❌ Invalid arguments format") result(false) return } if watchSession.isWatchAppInstalled { try? watchSession.updateApplicationContext(["forceLaunch": true]) } print("📤 Sending message to Watch: \(arguments)") watchSession.sendMessage(arguments, replyHandler: { response in print("✅ Message sent successfully") result(true) }, errorHandler: nil ) default: result(FlutterMethodNotImplemented) } }) }
1
0
47
4w