admin管理员组

文章数量:1122832

I’m developing an app where the iOS app (written in Flutter) communicates with a watchOS companion app. While the main app is built with Flutter, the communication between iOS and watchOS is implemented natively using WCSession, so the Flutter framework shouldn’t play a role in this issue. I structured the communication based on this article /@Toglefritz/building-a-watchos-companion-app-for-flutter-08f80ea8cb1b

The workflow is straightforward: the iOS app sends a message to the watch, and the watch starts performing tasks based on that message. For the majority of users, this works as expected. However, a small number of users are reporting issues where the message isn’t transmitted to the watch, seemingly because the WCSession is not reachable.

Here are some key details:

Setup:

  • The iOS app ensures WCSession is activated, and messages are sent using sendMessage(_:replyHandler:errorHandler:).
  • On the watchOS side, the app listens for incoming messages and processes them accordingly.

Problem:

  • For most users, the communication works without any issues.
  • For a subset of users, the watch app doesn’t receive the message, and the error handler on the iOS side indicates that the session isn’t reachable.
  • The issue is inconsistent and difficult to reproduce in testing. I’ve been unable to replicate the problem on my devices.

Questions:

  • Have you encountered similar issues with WCSession communication being unreliable or inconsistent?
  • Are there any known edge cases or conditions that could cause the session to be unreachable for some users?
  • Do you have any debugging tips or strategies for identifying the root cause of such issues?

Since the problem only occurs for a small subset of users and is not reproducible on my end, I’m at a loss for how to improve or debug this further. Any help or suggestions would be greatly appreciated!

Thanks in advance!

本文标签: iosWCSession not reachable for some usersStack Overflow