WatchKit

RSS for tag

Build apps that leverage watchOS features like background tasks, extended runtime sessions, and access to the Digital Crown using WatchKit.

Posts under WatchKit tag

110 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

There is a problem installing the iwatch app. It has been installing
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
0
0
375
Feb ’25
HealthKit: Seeking Guidance on Continuous, Near Real-Time Heart Rate Data Conitnously in IOS Application
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
1
0
689
Feb ’25
Unincluded dependencies failing to build for watchOS companion 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?
0
0
267
Feb ’25
Deeplink between two standalone watchos App
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.
1
0
1.1k
Feb ’25
Issue with Long Press and Drag Gesture Not Ending When Another Finger Swipes on watchOS
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!
1
0
683
Feb ’25
Immediate crash of Apple Watch simulator when typing a key
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
2
0
382
Mar ’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
846
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
585
Jan ’25
Configuring WebSocket API for watchOS App
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!
2
0
825
Jan ’25
Why is SKPhysicsBody not picking up alpha?! SpriteKit for a WatchOS game.
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?
2
0
497
Jan ’25
Sounds (beeps) & haptics not working anymore when in 'wrist down' mode (always on display)
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.
1
0
799
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
859
Jan ’25
Alarms- watch face widget no longer working properly.
Hello, since an update in September, the alarm widget on the watch face no longer counts down accurately like it used to. This is extremely frustrating for me because I used it for work so I have know exactly how much time I had in a particular circumstance. So for example, say I have an alarm set for 12:30. Before the update in September, I was able to look at my watch and know immediately that I had 24 minutes before the alarm, or look again and know it was the. 10 minutes before the alarm. Now, if I look at the watch face, it will say I have 24 minutes before the alarm, but it may actually only be 10 minutes before the alarm. I understand for some people this may be trivial, but it is really disappointing for me, and renders one of the most useful features of the Apple Watch useless to me now. I am hoping this is just an oversight during an update, so looking to see if this is something that is currently being worked on? I just installed beta 11.3 and still having the same issue. Now, if I press and hold on the watch face, like I’m going to change watch faces, then click out of it. It does update it. But it is not the same as it used to be. Thank you
2
0
394
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
501
Dec ’24
WidgetCenter.shared.reloadAllTimelines() doesnt work when app in background
I have an iOS app, watchOS app, and iOS Widget that shows the most recent data in the database. The watch app sends data to the iOS app over the WCSession and is received in session(didReceiveMessage, replyHandler). After that data is processed, reloadAllTimelines() is called. When running in Simulator or on device plugged in to debugger, it works, the widget updates when the app is closed (in background, even if force quit). But when running TestFlight or App Store build, the data is still processed and saved to Core Data (I open the app and it's there), but the widget doesn't update. It seems that reloadAllTimelines only works when the app is in foreground (at least in non debug builds). I dont have an iOS 17 device to check but I think this is a recent bug with iOS 18.
2
2
556
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
518
Dec ’24