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

scenePhase not work consistently on watchOS
Hi there, I'm using WCSession to communicate watchOS companion with its iOS app. Every time watch app becomes "active", it needs to fetch data from iOS app, which works e.g. turning my hand back and forth. But only when the app is opened after it was minimised by pressing digital crown, it didn't fetch data. My assumption is that scenePhase doesn't emit a change on reopen. Here is the ContentView of watch app: import SwiftUI struct ContentView: View { @EnvironmentObject private var iOSAppConnector: IOSAppConnector @Environment(\.scenePhase) private var scenePhase @State private var showOpenCategories = true var body: some View { NavigationStack { VStack { if iOSAppConnector.items.isEmpty { WelcomeView() } else { ScrollView { VStack(spacing: 10) { ForEach(iOSAppConnector.items, id: \.self.name) { item in ItemView(item: item) } } } .task { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { loadItems() } } .onChange(of: scenePhase, initial: true) { newPhase, _ in if newPhase == .active { loadItems() } } } fileprivate func loadItems() -> Void { if iOSAppConnector.items.isEmpty { iOSAppConnector.loadItems() } } } What could be the issue? Thanks. Best regards Sanjeev
1
0
224
4d
Has Background Refresh Stopped Working on watchOS 26?
Hi everyone! My Apple Watch app has relied for years on the WKApplication.scheduleBackgroundRefresh(...) method to keep the app updated in the background. The system would reliably trigger WKApplicationDelegate.handle(_:), where I would then schedule the next refresh task (usually 15 minutes later). As stated in the documentation, as long as there is a complication on the watch face, these background tasks should run at a relatively stable frequency. However, this approach seems to have stopped working on watchOS 26. I no longer receive any WKApplicationRefreshBackgroundTask at all. Has anyone else experienced this issue?
2
0
95
3w
Guidance / Documentation on iOS 18.6.1 Blood Oxygen Saturation
Are there any HealthKit related changes to be aware of in the new update that enables SPO2 / Blood Oxygen Saturation measurements on certain Apple Watch models within the US? I’m aware of processing happening on the phone…. But beyond that: Does this mean values are then saved to Apple Health? Do these models still take background SPO2 measurements in the same way as other models do? Are these values then visible in third party iOS apps as normal through HealthKit? Do these values sync back to the paired Apple Watch HealthKit store for third party apps to access on the Watch? For reference I have an iOS and WatchOS app that, amongst other features, provides the ability to see your SPO2 values in the Watch app, complications and in the iOS app.
2
0
98
2w
Issue with opening browser on Apple Watch SE 2 – black screen
Hello, I am experiencing an issue when trying to open the browser on my Apple Watch SE 2 running the latest version, watchOS 11.6. When I attempt to visit any website, the browser opens and displays the URL at the top as if it is loading, but the screen remains black and no content is displayed. The internet connection is available, and all other apps on the watch work normally. This issue occurs only with the browser. I would appreciate any guidance or solution to resolve this problem. Thank you for your assistance.
2
0
194
3w
Upload failed Validation Issue WKApplication or WKWatchKitApp is required
I added a watchkit extension to an existing app. I get this error when uploading to App Store Connect. Building the archive itself is fine: Prepared archive for uploading Upload failed error: Validation failed Missing Info.plist value. A value for the key “WKApplication”, or “WKWatchKitApp” if your project has a WatchKit App Extension target, is required in “Runner.app/Watch/watch_Watch_App.app” bundle. For details, see: https://developer.apple.com/documentation/watchkit/creating_independent_watchos_apps/setting_up_a_watchos_project have the exact same issue when bundling. I added the flag manually in a additional plist fields entry with WKApplication=1 because my Info.Plist is generated and it didn't help. I wrote a custom Run Script Phase that added the flag and that didn't help as well. I need a reply from someone from Apple here. This needs to be fixed.
5
0
233
3w
WatchOS smart alarm using WKExtendedRuntimeSession
I’m developing a smart alarm app that makes use of the extended runtime session. I’ve looked at the docs, and one of the background modes for Apple watch is smart alarm. The docs also say that an extended runtime session can only be scheduled one at a time, and while the app is open, which isn’t very intuitive for an alarm app that runs on schedules. I’ve seen other apps do something similar, but I’m trying to make this fully automated, without the user having to do too much manually to reschedule the smart alarm. Is there no way to do this? I would’ve thought the smart alarm background modes would allow to schedule more than 1/a repeating extended runtime session.
1
0
117
Jul ’25
Couple simple suggestions to make WKExtendedRuntimeSession a lot better
I just launched my watch app with alarms using WKExtendedRuntimeSession, as an api I wish it was possible to: set a small title/message on the alarm ui itself, right now all it displays is the "Alarm from < app name >" with the app icon, but it would be nice to be able to set a short 1~2 line message below it as well! be able to read the current scheduled date, right now it's only possible to know it's scheduled.
2
0
73
Jul ’25
Using notifyUserWithHaptic for Background Alarms in Standalone Watch App
I’m building a standalone Apple Watch smart alarm app that should trigger alarms on the watch in response to Bluetooth or internet events. This means the app operates in the background and attempts to trigger an alarm when such an event occurs. As far as I know, the appropriate API for this is WKExtendedRuntimeSession.notifyUserWithHaptic:repeatHandler. However, I can’t seem to start an extended runtime session while the app is in the background. I’m getting the following error: -[WKExtendedRuntimeSession _invalidationReasonAndDelegateCallbackErrorForError:outCallbackError:]:729: WKExtendedRuntimeSession hit internal error. Error Domain=com.apple.CarouselServices.SessionErrorDomain Code=17 "startSession cannot be called on a scheduled session" UserInfo={NSLocalizedDescription=startSession cannot be called on a scheduled session} Calling notifyUserWithHaptic directly also similarly fails. It seems notifyUserWithHaptic is intended to be scheduled during a foreground session to trigger at a later time, rather than being called ad hoc from a background context. Is there any way to create a proper alarm view on the Apple Watch from a background execution context?
0
0
41
Jul ’25
Apple Watch Logs and Debugging
Developing a standalone app for the Apple Watch. Unless I turn off Bluetooth on the paired iPhone, the Apple Watch’s Wi-Fi deactivates every ~30 seconds, which causes the connection to Xcode to drop. How is this supposed to work? I can see my app’s logs in Xcode, but I can’t view any other system logs from the Apple Watch. I tried using the Console app, with the iPhone connected via USB, trusted, etc, but I don't see any system logs. How can I access full system logs? Thanks!
1
0
134
Jul ’25
Update Complications in WatchOS from iOS using WatchConnectivity?
I'm trying to update data displayed in my Watch Complications (WidgetKit). I have an iOS app that sends data to the Apple Watch using WCSession.default.transferUserInfo. However, the data only updates on the complications or widgets after I open the watchOS app manually. Ideally, I'd like the Watch widget/complication to reflect the updated data as soon as it's sent from the iPhone, without requiring the user to open the Watch app.
1
0
94
Jun ’25
Maximise background update on WatchOS
I'm looking to maximise my Watch app's widget to be as up to date as possible. If we imagined the app was a simple step counter, and we wanted to display the users count as up to date as possible. We can conclude: We don't care about widget timelines beyond the current entry as we can't predict the future! We need to refresh the count as often as possible The refresh should be very quick with a straightforward HealthKit query, no networking or heavy work needed. We will assume the user has the complication/widget on their active Watch face. With the standard WidgetKit APIs we can expire the timeline after 15 minutes and in my experimentation a Watch app can usually update its widget timeline at that frequency if it's on the Watch face. I'm experimenting with two methods to try and improve refreshes further A user's step count might not have recently changed when the timeline update is called. I was therefore looking into the HealthKit enableBackgroundDelivery API (which requires the HealthKit Background Delivery entitlement to be enabled) to get updates limited to once an hour from a HKObserverQuery, I can then call the WidgetCenter.shared.reloadAllTimelines() from there. WatchOS also support the BGAppRefreshTaskRequest(identifier:"") and .backgroundTask(.appRefresh) APIs. I can request updates once every 15 minutes here too and then call the WidgetCenter.shared.reloadAllTimelines(). With option 1, this update opportunity is great as it will specifically update when there's new steps so even once an hour this would be helpful (A real shame to be limited to once an hour even if this used up WidgetKit standard reload budgets: FB13879817, FB11677132, FB10016177). But I can't determine if this update takes away one of the standard timeline expiration updates that already run 4 times an hour? Could I observe additional Health types to get additional updates? Do I need the Background Modes Capability as well as the HealthKit Background Delivery for this in Xcode or just the HealthKit one? With option 2, I can't find a suitable option in the (short) list of supported background modes in Xcode. Does not selecting any mean my app will get 0 refreshes from this route and so should not be implemented in my use case?
3
1
111
Jun ’25
Apple Watch Data to Server
I was wondering which is the preferred way to send a lot of data from sensors of the apple watch to server. It is preferred to send small chucks to iphone and then to server or directly send bulk data to server from watch. How does it affect battery and resources from watch ? Are there any triggers that I can use to ensure best data stream. I need to send at least once a day. Can I do it in background or do I need the user to have my app in the foreground ? Thank you in advance
1
0
89
Jun ’25
Fitness app not now show saved routes
When I set the distanceFilter = 5 (5 meters) in the GPS CLLocationManager I can't display the workout routes in the Apple Fitness app after writing the recorded GPS data to HealthKit via HKWorkoutRouteBuilder. The smaller distanceFilter, Fitness will displays the route. Should I consider setting up a small distanceFilter when developing a workout app on watchOS?
5
0
103
Jul ’25
Launching an apple watch app from the companion app
Hi, as stated in the title I'm trying to launch a watchOS app from its companion iOS app. My issue is very similar to this post: https://developer.apple.com/forums/thread/734362 The response from apple in that post says that it is not possible, but I have found it to be possible for media apps. Specifically if you turn Settings > General > Auto-Launch > Live Activities > Media Apps and turn Auto-Launch to "App". My app is for medical research and having this available would be very helpful for our testing. I need the app to be fully in the foreground. Is there a way to get specific permissions for our app to do this? Am I missing something? I've tried starting a workout session to accomplish this, but it only seems to work when the watch is charging. Any feedback is appreciated, thank you.
1
0
82
Jun ’25
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
95
Jun ’25
Background communication of Apple Watch
I am currently developing an app for the Apple Watch. In RTPController.swift, I handle the sending, receiving, and playback of audio, and the specific processes are as follows: Overview of the current implementation: Audio processing: Audio processing is performed by setting the AVAudioSession to the playAndRecord category and voiceChat mode within RTPController, and by activating the AVAudioEngine. Audio reception: RTP packets (audio data) are received over the network within the setupConnection() method of RTPController. Audio playback: The received audio data is passed to the playSound(data:) method and played back through the AVAudioEngine and AVAudioPlayerNode. Xcode Capabilities settings: Signing &amp;amp; Capabilities Background Modes: Audio, AirPlay, and Picture in Picture Voice over IP Workout processing Privacy descriptions in Info.plist: Privacy - Health Share Usage Description Privacy - Health Update Usage Description Privacy - Health Records Usage Description Question 1: When the digital crown is pressed during a call, a message appears on the screen stating, "End Call to Continue," and the call cannot be moved to the background. As a result, it is not possible to operate other apps while on a call. Is this behavior due to the specifications of CallKit? Question 2: Our app stops communication when it goes into the background, but the walkie-talkie app on the Apple Watch can transition to the background by pressing the digital crown during a call, allowing it to continue receiving and playing the other party's audio while in the background. To achieve background transition during a call and audio reception and playback in the background, is the current implementation of RTPController and the enabled background modes insufficient? Best regards.
1
0
89
Jun ’25
Confused by what is allowed for System Level Apple Watch Bluetooth Connection. Does it require MFi or are there only some BLE chips allowed?
Hello. I am building a BLE device that is Activity Fitness based and would like a "System Level" BLE connection on WatchOS using an ESP32 (I have built a test of this on the firmware side). Meaning I do not want my iOS app to pass the BLE connection to the WatchOS app. It seems like these App Level connections do not get as many background updates as a System Level connection, and also requires the WatchOS app to be launched to connect to the BLE device The System Level BLE connection (WatchOS Settings > BLE > Health Devices) allows for auto connection in the background, and gets more reliable background communication between the BLE device and the Apple Watch On the Apple MFi Page it only mentions iOS: From Apple MFi Page: :: Who does NOT need to join - Developers and manufacturers of accessories that connect to an Apple device using only Bluetooth Low Energy, Core Bluetooth, or standard Bluetooth profiles supported by iOS Does this apply to WatchOS as well? So, if I am making an BLE device that is Activity Based, and has one of the allowable Health Device UUIDs, is the BLE System Connection allowed using any BLE chip? Including say an ESP32 I have built a test BLE firmware that is a Health Device UUID, and the WatchOS sees it as a health device Is this fine then? No need for MFi application and also no need to worry about which BLE chip is used? thanks
3
0
95
May ’25
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.
1
1
126
May ’25
WKApplication、WKWatchKitApp
Validation failed Missing Info.plist value. A value for the key “WKApplication”, or “WKWatchKitApp” if your project has a WatchKit App Extension target, is required in “demo.app/demo.app” bundle. For details, see: https://developer.apple.com/documentation/watchkit/creating_independent_watchos_apps/setting_up_a_watchos_project (ID: 1***fc8) 我们APP中没有watchkit相关功能,但是在xcode16.3上传包的时候一直提示此错误?是什么原因?
3
1
107
Jul ’25