Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Watch Connectivity

RSS for tag

Implement two-way communication between an iOS app and its paired watchOS app using Watch Connectivity.

Posts under Watch Connectivity tag

44 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Real-Time WatchConnectivity Sync Not Working Between iPhone and Apple Watch
Hi everyone, I'm building a health-focused iOS and watchOS app that uses WatchConnectivity to sync real-time heart rate and core body temperature data from iPhone to Apple Watch. While the HealthKit integration works correctly on the iPhone side, I'm facing persistent issues with WatchConnectivity — the data either doesn't arrive on the Watch, or session(_:didReceiveMessage:) never gets triggered. Here's the setup: On iPhone: Using WCSession.default.sendMessage(_:replyHandler:errorHandler:) to send real-time values every few seconds. On Apple Watch: Implemented WCSessionDelegate, and session(_:didReceiveMessage:) is supposed to update the UI. Both apps have WCSession.isSupported() checks, activate the session, and assign delegates correctly. The session state shows isPaired = true and isWatchAppInstalled = true. Bluetooth and Wi-Fi are on, both devices are unlocked and nearby. Despite all this, the Watch never receives messages in real-time. Sometimes, data comes through in bulk much later or not at all. I've double-checked Info.plist configurations and made sure background modes include "Uses Bluetooth LE accessories" and "Background fetch" where appropriate. I would really appreciate guidance on: Best practices for reliable, low-latency message delivery with WatchConnectivity. Debugging steps or sample code to validate message transmission and reception. Any pitfalls related to UI updates from the delegate method. Happy to share further details. Thanks in advance!
1
0
14
2d
reloadAllTimelines() is broken on watchOS 11.5
I am experiencing an issue with my watchOS app. My application updates a shared file, accessible by both the main app and the WidgetKit extension, during a WatchConnectivity background task. Following this update, I call reloadAllTimelines(). This functionality worked as expected on watchOS 10, even without Developer Mode enabled. However, after updating my device to watchOS 11.5, this API appears to be broken. My reasons for believing this API is broken are threefold: The functionality worked reliably on watchOS 10. On watchOS 11.5, enabling "WidgetKit Developer Mode" (found under Settings > Developer) resolves the issue, and my complications update correctly. When I enter watch face edit mode, the snapshot/preview displayed (which utilizes the same underlying logic as the timeline API) shows the correct data. This indicates that the data has been successfully received from the phone, and the widget is indeed reading the updated shared file. Despite this, the actual widget view during its resting phase never updates. It's worth noting that TimelineReloadPolicy functions as expected, but I cannot rely on this for my use case. My widget requires immediate updates upon receiving new data. Apple, please investigate this behavior.
1
0
69
5d
Trying to deploy WatchOS 9.6 to a watch that is on 10.6
I have an Apple Watch 4. (GPS). It's on version 10.6. I'm trying to deploy a basic app onto it (IOS 18) (WatchOS 9.6). I've set the targets in General for Watch App, Watch AppTest, Watch AppUITest. I still get an Apple Watches watchOS doesn't match App Watch app.app watch02 9.6 deployment target. Upgrade users Apple Watch watchOS version or lower app app.apps deployment target. What can I do to fix this?
1
0
78
5d
watchOS workout app not reachable from iOS (sometimes)
In general my workout app is reachable from the iPhone when running a workout, even if in the background. However if the watch app restarts (due to crash or being closed via the dock) via handleActiveWorkoutRecovery then it is only reachable when in the foreground, even though a workout is running. Is this expected / desired behaviour? Is the app given a tighter sandbox (having it's "background privileges" reduced) because of the earlier crash? This behaviour occasionally happens without a crash (or being closed via the dock) - all of a sudden it is no longer reachable via the iPhone. It feels like the app is being "sandboxed" like in #1 but there is no crash or any other kind of log indicating any issue. Generally the only remedy is to stop the workout and restart the app. My question is - is this expected? Is there some condition that causes the watchOS to sandbox the app? Or is this a Watch Connectivity bug?
0
0
49
3w
Apple Watch stuck on "Copying shared cache symbols" – blocks real-time testing via Xcode
Hi everyone, I’m a student developer currently building a watchOS app that uses HealthKit and HKWorkoutSession to estimate core body temperature from real-time heart rate data. The app runs well in the simulator, but testing on a physical Apple Watch has been extremely difficult. Each time I try to run the app from Xcode (Version 16.3), the build gets stuck on: “Copying shared cache symbols from MyWatchName (0% completed)” Sometimes it just stops stating connection failure. However, more often no errors are shown, but the sync never finishes. I’ve tried the following without success: Restarting the watch, iPhone, and Xcode Switching networks (Wi-Fi and hotspot) USB wired pairing Resetting developer settings and trust prompts Deleting derived data Rebuilding the project This is especially limiting for a real-time health tracking app where I need to monitor HKLiveWorkoutBuilder data while the screen sleeps — which can’t be tested effectively in the simulator.
0
0
53
4w
Apple Watch Fails to Receive Companion App Message
Hello all, I have run into a weird situation in my watchOS app with a companion iOS app. Issue: Watch fails to receive sendMessage string sent from phone while watch is in foreground. This is not consistent and seems to happen randomly under certain conditions. Order of operations: User Opens phone app & watch app -> user presses "sendMessage" button, func is called -> watch does not receive message while in foreground Condition explanation: To my knowledge, without a HealthKit workout session active, the apple watch is not available to receive messages (using any internal library transmission type) from its iOS companion app while the watch screen is not in the foreground (i.e. inactive). However, my issue is that sometimes, while the watch IS in the foreground, it does not receive the companion app's message. Additionally, this is not resolved by force quitting both iOS and watchOS apps. The only way I have gotten this issue to go away is by restarting both the phone and the watch. Again, it is not a consistent behavior and seemingly happens randomly. This behavior has been observed across multiple different beta testers on different hardware. This is only apparent when transmitting from Phone -> Watch. I have not experienced any transmission issues when transmitting Watch -> Phone. My team and I have speculated that it could be an issue with WCSession.isReachable returning true before we transmit the message but changing to false before the hardware actually transmits. However, this wouldn't explain why the watch would not be available while in the foreground. This is just a preliminary thought. My goal in posting on here is to see if anyone else has experienced this, or if it's a known bug. All message protocols have been coded to follow Apple's WCSession documentation as closely as possible. Hardware specs: Watch Model: A2093 (series 5) WatchOS ver: 10.6.1 Phone: MU693LL/A (15 pro max) iOS ver: 18.3.2 XCode ver: 16.0
1
0
51
Mar ’25
Auto Dial - 911
My app monitors users heart beats and if critical reading is noticed, it auto -dials 911 for emergency and ambulance help. I was under the impression that auto-dial may not be permitted or possible on the platform. Can anyone confirm and provide any additional guidance on if it is possible in the newer SDK/API stack or using any 3rd party service ? Thank you in advance!!
0
0
267
Feb ’25
How to make watchos keep the screen on continuously
We developed a camera remote control app for Apple Watch, but during the development process, we found that Apple Watch is prone to sleep on its own without screen interaction (usually automatically sleeping between 5s and 15s when there is no interaction, but our Apple Watch app actually receives the camera preview video frame data we transmit all the time, and there is no data interaction), and then triggers the sessionReachableDidChange function, and the session.isRechable is false. We hope that the camera remote control app for our Apple Watch can remain on when in the foreground, making it convenient to control our camera app on our phone. We found that DJI's Apple Watch app does not automatically sleep and does not sleep for more than 2 minutes. We have tried many methods, such as heartbeat packets, and I have added WKSupportsAlwaysOnDsplay to the Apple Watch info.plist file, but have not found an effective solution. I hope you can provide assistance, thank you.
1
0
544
Feb ’25
Watch-Phone communication when Phone app is in background
There doesn't seem to be a background mode that will allow an iPhone app to run in the background in order to communicate with its watch app, which is running in the foreground on the watch. Have I missed something? Related but not quite the same: say the iPhone app can run in the background to get location updates. But it only wants to do so when the watch app is running. Is there a way that the watch app can wake, or even start, the iPhone app, and for the iPhone app to then enable location updates? (I have previously implemented Bluetooth background modes - I think I could achieve both of the above if I had the watch and the iPhone communicate using my own BTLE protocol, rather than using Watch Connectivity. Is this true?)
6
0
823
Feb ’25
Swift 6 concurrency. Apple Watch App target and -disable-dynamic-actor-isolation.
I've got a watch app, still with storyboard, WKInterfaceController and WatchConnectivity. After updating it for swift 6 concurrency I thought I'd keep it for a little while without swift 6 concurrency dynamic runtime check. So I added -disable-dynamic-actor-isolation in OTHER_SWIFT_FLAGS, but it doesn't seem to have an effect for the Apple Watch target. Without manually marking callbacks where needed with @Sendable in dynamic checks seem to be in place. swiftc invocation is as (includes -disable-dynamic-actor-isolation): swiftc -module-name GeoCameraWatchApp -Onone -enforce-exclusivity\=checked ... GeoCameraWatchApp.SwiftFileList -DDEBUG -enable-bridging-pch -disable-dynamic-actor-isolation -D DEBUG -enable-experimental-feature DebugDescriptionMacro -sdk /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.2.sdk -target arm64_32-apple-watchos7.0 -g -module-cache-path /Users/stand/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/stand/Library/Developer/Xcode/DerivedData/speedo-almhjmryctkitceaufvkvhkkfvdw/Index.noindex/DataStore -enable-experimental-feature OpaqueTypeErasure -Xcc -D_LIBCPP_HARDENING_MODE\=_LIBCPP_HARDENING_MODE_DEBUG -swift-version 6 ... -disable-dynamic-actor-isolation flag seems to be working for the iOS targets, I believe. The flag is described here Am I missing something? Should the flag work for both iOS and Apple Watch targets?
2
0
542
Jan ’25
Should WCSession.isPaired be true before checking WCSession.isWatchAppInstalled ?
I have a depended watch app bundled with my iOS app. // ... <key>WKRunsIndependentlyOfCompanionApp</key> <false/> // ... My code: guard WCSession.isSupported() else { return } let session = WCSession.default session.delegate = self session.activate() public func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { // ... if (session.activationState == .activated) { let log = Log(isPaired: session.isPaired, isWatchAppInstalled: session.isWatchAppInstalled) uploadLogToServer(log) } // ... } and also: guard WCSession.isSupported() else { return } let session = WCSession.default guard session.activationState == .activated, session.isWatchAppInstalled else { return } do { try session.updateApplicationContext(...) } catch { uploadErrorToServer(error) } What I've observed is that when I query the logs in the server's database, I get entities with isPaired = false and isWatchAppInstalled = true. Also, when I query the errors I see deviceNotPaired errors. So my question is, does Should WCSession.isPaired property be true before accessing WCSession.isWatchAppInstalled property ?
1
0
820
Jan ’25
WatchConnectivity Swift 6 - Incorrect actor executor assumption
I am trying to migrate a WatchConnectivity App to Swift6 and I found an Issue with my replyHandler callback for sendMessageData. I am wrapping sendMessageData in withCheckedThrowingContinuation, so that I can await the response of the reply. I then update a Main Actor ObservableObject that keeps track of the count of connections that have not replied yet, before returning the data using continuation.resume. ... @preconcurrency import WatchConnectivity actor ConnectivityManager: NSObject, WCSessionDelegate { private var session: WCSession = .default private let connectivityMetaInfoManager: ConnectivityMetaInfoManager ... private func sendMessageData(_ data: Data) async throws -> Data? { Logger.shared.debug("called on Thread \(Thread.current)") await connectivityMetaInfoManager.increaseOpenSendConnectionsCount() return try await withCheckedThrowingContinuation({ continuation in self.session.sendMessageData( data, replyHandler: { data in Task { await self.connectivityMetaInfoManager .decreaseOpenSendConnectionsCount() } continuation.resume(returning: data) }, errorHandler: { (error) in Task { await self.connectivityMetaInfoManager .decreaseOpenSendConnectionsCount() } continuation.resume(throwing: error) } ) }) } Calling sendMessageData somehow causing the app to crash and display the debug message: Incorrect actor executor assumption. The code runs on swift 5 with SWIFT_STRICT_CONCURRENCY = complete. However when I switch to swift 6 the code crashes. I rebuilt a simple version of the App. Adding bit by bit until I was able to cause the crash. See Broken App Awaiting sendMessageData and wrapping it in a task and adding the @Sendable attribute to continuation, solve the crash. See Fixed App But I do not understand why yet. Is this intended behaviour? Should the compiler warn you about this? Is it a WatchConnectivity issue? I initially posted on forums.swift.org, but was told to repost here.
3
0
1.1k
Jan ’25
Apple Watch Connectivity Issues XCode
Whenever I try to build on my Apple Watch using Xcode, I often encounter connection issues. It typically takes about an hour of troubleshooting, including restarting devices, restarting Xcode, erasing the Apple Watch, and other steps. I was wondering if anyone else has experienced similar problems and if there are any effective solutions.
0
0
470
Dec ’24
Workout mode drains battery heavily
I am building a watchOS app with iOS companion app. The watch app needs to track the heart rate during the night or while user is sleeping. And the desired frequency of measurement is 0.2Hz (every 5 seconds) For this I am using the HKWorkout mode with mindAndBody session. While it works fine, One of the main issue is: after about 6-7 hours of usage, the battery on the watch drains between 40% (Series 9) and 100% (series 7, I think) My questions: Are there any other option to track user's heart rate without workout, while the app could be in background? Another side effect of this workout mode is, Even if we choose not to save the workout in HealthKit, the Activity rings gets populated by this mindAndBody session, which makes it when the user is waking up, the bar is already full, This is not desired. Is there any option to specify for ActivityRing skips this? Highly appreciate any help in advance. Cheers - Prakash
5
0
1.1k
Dec ’24
SimpleWatchConnectivity sample - TransferFile fails
When launching the SimpleWatchConnectivity sample in a simulator (iOS 18.2 + watchOS 11.2), almost all the functionality works, but TransferFile does not work. The error is the following: -[WCFileStorage persistOutgoingFileTransfer:] error serializing file transfer <WCSessionFileTransfer: ...> due to Error Domain=NSCocoaErrorDomain Code=4866 "Caught exception during archival: This object may only be encoded by an NSXPCCoder." How can it be fixed or worked around?
1
1
492
Dec ’24