Apple Watch automatically tracks sleep data and syncs it to the iPhone, making it available through HealthKit for historical analysis. However, there is no way to retrieve real-time data on whether a user has entered sleep, or whether they are in a specific sleep stage at any given moment.
Is it possible to provide an interface for real-time sleep status monitoring
WatchKit
RSS for tagBuild apps that leverage watchOS features like background tasks, extended runtime sessions, and access to the Digital Crown using WatchKit.
Posts under WatchKit tag
138 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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!!
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.
I've made the code in xcode for apple watch with 2 swift view (contentView.swift and interfaceController.swift).The swift for sound and haptic feedback is in InterfaceController.swift. But the the sound does not appear with haptic feedback in apple watch after complete the xcode.
the app is done but no sound appear with haptic feedback when rotate apple watch digital crown. when crown rotated but sound appear
code
import WatchKit
import AVFoundation
import WatchKit
class InterfaceController: WKInterfaceController {
// ... your UI elements
func playSelectionHapticAndSound() {
// Play a haptic feedback pattern
WKInterfaceDevice.current().play(.success)
// Load and play a selection sound effect
guard let soundURL = Bundle.main.url(forResource: "spin", withExtension: "wav") else { return }
do {
let player = try AVAudioPlayer(contentsOf: soundURL)
player.play()
} catch {
print("Error playing sound: \(error)")
}
}
}
We have recently developed the iwatch app. We will package the APP + iwatch app and publish it in testfight for test download. However, we often find that after the mobile app is downloaded, the iwatch app is also on the iwatch System application inside display. Click install is always in the installation. It has not been installed. Especially when the phone we tested is paired with several watches. Or delete the mobile APP and download it again to recover. But some situations still cannot be recovered. May I ask why it is always installed? We have confirmed that there is no problem with the network, and the pairing connection between the watch and the mobile phone is normal. This problem has caused us a lot of trouble. I wonder if this will happen in the app store. Please give the official reply
I am working on watch os project. I need to check network connectivity when user turn on and off the network.
I am using NWPathMonitor for check network availability. I am connected with wifi but it still showing unsatisfied not real device but it's working perfect on simulator.
Dear Apple Developer Support,
I am writing to request assistance with an ongoing issue I'm encountering while developing an iOS application that utilizes HealthKit to fetch heart rate data.
My goal is to display near real-time heart rate updates continuously same as displaying in the Apple Watch , I want to show in the iPhone Mobile Application for fitness related. I have implemented the following approaches:
HKSampleQuery with a Timer: I've set up a timer to periodically fetch the latest heart rate data.
Despite these efforts, I'm consistently facing the following problems:
Delayed Updates: The heart rate data displayed in the app often doesn't reflect the current heart rate being measured by the Apple Watch. There seems to be a significant synchronization delay.
Inconsistent Background Updates: Background updates, even with background app refresh enabled, are not reliable. The app often only updates when brought to the foreground or after being killed and relaunched.
Entitlements: The com.apple.developer.healthkit.background-delivery entitlement error is missing.
I have thoroughly reviewed Apple's HealthKit documentation, implemented best practices for HealthKit integration, and verified that all necessary permissions are properly configured.
I understand that HealthKit may not be designed for true real-time data, but the current level of delay and inconsistency is making it difficult to provide a useful user experience.
Could you please provide guidance on whether achieving near real-time heart rate updates continuously in an iOS app using HealthKit is possible? If so, what are the recommended strategies and best practices to overcome these limitations?
I have also tested the application on physical devices with Apple Watch, enabled background app refresh, granted permissions, and referred to HealthKit documentation.
I would appreciate any insights or suggestions you can offer to help resolve this issue.
Thank you for your time and assistance.
Sincerely,
Venu Madhav
I just created watchOS app alone a few months ago but I wanted to make a complication extension for my Apple Watch face. Without the aid of existing iOS app
When trying to use the watchOS preview the simulator fails to load and throws about 15 errors. Clearly the simulator is trying to load all of the iOS packages to the watchOS simulator. However, these packages clearly aren't included in the watchOS app. Furthermore, both apps build successfully to the main simulators, just not the previews. Having a list of errors that simply should not be there is a pretty big annoyance when something is going wrong. How do I fix this?
I have two standalone app written for watchos (standalone). One to authenticate and one for connectivity to real-world devices. The connectivity app uses the authentication app before every action, Im testing this with two xcode projects I have created and tried different things ended up with this error.
authapp://authenticate?callback=linkingapp://callback
-[SPApplicationDelegate extensionConnection:openSystemURL:]:2418: URL with scheme "authapp" not supported
how to get the url scheme working? Tested this in simulator and real device. info.plist and AppDelegate files are placed in both apps.
I am developing a watchOS app with a tab view, and inside one of the tabs, I have a 2x2 collection view layout. Each collection item contains a view that handles:
Tap Gesture (.onTapGesture) → Executes an action immediately.
Long Press Gesture (LongPressGesture) → Triggers an update when long press starts and again when it ends.
Drag Gesture (DragGesture) → Updates the position while dragging and resets values when the gesture ends.
Issue:
Most of the time, the gestures work correctly, but if another finger swipes on the screen while a long press is active, sometimes the onEnded event does not trigger, leaving the button in an active state.
Observations:
The onTapGesture executes normally without issues.
The LongPressGesture starts as expected, but if another finger interacts with the screen, the onEnded of the drag gesture does not always trigger.
This results in the button remaining visually or functionally "pressed" until another interaction occurs.
Has anyone encountered similar behavior in watchOS? How can I ensure that long press and drag gestures always complete even when another finger swipes on the screen?
Thanks in advance!
I get a crash in Apple Watch simulator (Series 9 45mm 18.0) as soon as the app launch if I type anything on external keyboard (just hitting command key for instance to capture a screenshot). Same crash on series 7 (45mm, OS 18.1)
But app works normally when I use mouse to interact with the app on simulator.
App does not crash on real device (Watch 4 OS 10.4.1).
Nor does it crash on Series 6 simulator (44 mm OS 17.4).
Here are the log I could collect (apparently, they contain sensitive language !!! so I attach as a file.:
Attached logs
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?)
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?
Hi all,
I’m developing a watchOS app that uses a WebSocket API to process voice audio. However, I keep encountering this error when trying to establish the connection:
nw_endpoint_flow_failed_with_error [C1 <server URL>:443 failed parent-flow (unsatisfied (Path was denied by NECP policy), interface: ipsec2, ipv4, ipv6, proxy)] already failing, returning
I’ve read Technical Note TN3135, which outlines an exception for audio streaming apps. My app is an audio streaming app, and I’ve already added background audio mode to the app’s capabilities. However, I’m not sure what else is required to meet the exception described in TN3135.
Questions
How do I meet the exception outlined in TN3135 for WebSocket audio streaming on watchOS?
Does NECP enforce additional restrictions even with background audio enabled, and how can I address this?
Any guidance or examples of implementing WebSocket audio streaming on watchOS would be greatly appreciated.
Thanks!
Hi all. Does anyone know if there's a way to get a list of watch faces for a paired Apple Watch or to set the current face? Or is this just not allowed?
I've taken a look at the WatchOS, WatchKit, and WatchConnectivity documentation and no luck there.
Hi everyone. Does anyone know if there a way to get a list of watch faces for a paired Apple Watch, or to set the current watch face? Or is this just not allowed?
Have looked through the WatchKit, WatchConnectivity, and WatchOS documentation and haven't found anything.
So I'm trying to use SpriteKit to make the background of my game. The walls have alpha 1.0, and the safe area alpha 0 and fully transparent. (e.g. a big black square with a smaller transparent square in the middle of it). Yet sprite kit always assume the entire image is either fully opaque or fully transparent. That defies its purpose isn't it? Is there a way to make this work?
Our watch app, Regatta Timer, is a specialised countdown timer for sailing competitions. It is crucial that the beeps & haptics continue when 'wrist down' on alway on displays. We tried to enable this by adding 'background mode' but that only works in the Xcode Apple Watch simulator, not on an actual device with always on display. Any idea how we can get this working also on the Apple Watch device?
In ContentView.swift we currently added this code:
WKInterfaceDevice.current().play(sound)
}
but that doesnt work - regardless of adding , phase == .active`
or not.
STEPS TO REPRODUCE
Install on an ACTUAL DEVICE with always on display
start the countdown timer: beeps & sounds are OK (each minute,...)
do 'wrist down': the countdown timer continues on the dimmed display, but the sounds & haptics stop working until you raise your wrist to wake up the display.
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 ?