WatchConnectivity Background

WatchOS app is running in the foreground and can wake up the iOS app, but it can't trigger didReceiveMessage in the iOS app.

iOS and Watch apps in the foreground can communicate with each other without any issues. However, when my app is closed, even though it wakes up, it cannot communicate. Any ideas? Should I be using a background task ios app side?

Use WCSession.transferUserInfo(_:) to send data that can be received in background. Implement session(_:didReceiveUserInfo:) in the delegate to receive this kind of messages.


WindowsMEMZ @ Darock Studio

"WatchOS app is running in the foreground and can wake up the iOS app, but it can't trigger didReceiveMessage in the iOS app."

This didn't happen to me when I verified with the following Apple sample:

Would you mind to check if you see the issue with the above sample, and if yes, share the detailed steps?

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

"Did you do it using sendMessage or transferUserInfo?"

I tried sendMessage with the following steps:

  1. Follow the Readme to build and run the sample app on devices.
  2. Launch the iOS app, and swipe up to push the app to the background and return to the home screen.
  3. Launch the watchOS app, navigate to the SendMessage tab, then tap SendMessage, and observe the "Replied at <timestamp>".
  4. On the iOS side, bring the app back to foreground, and observe the "Received at <timestamp>" message.

I tried with my iPhone 16 Plus + iOS 18.0.1 and Apple Watch Series X + watchOS 11.0.1.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

WatchConnectivity Background
 
 
Q