Hi,
I found a behavioural difference in the DatePicker between WatchOS and iOS when limiting the date and time range. In the code below I'm attempting to limit the date and time range so that dates and times in past can be chosen. In iOS the DatePicker hides the dates and times that are out of range but WatchOS only the DatePicker for the date does this. The time DatePicker allows all times. The output from DatePicker is limited to the valid range, so it appears that it's the DatePicker UI that doesn't match the iOS behaviour. Does anyone know if there's a way to DatePicker that chooses the time only show valid times like iOS?
import SwiftUI
struct HistoryPeriodView: View {
@State private var selectedDate = Date()
@State private var selectedTime = Date()
var body: some View {
VStack {
// Date Picker for selecting the date (Restricts to today or earlier)
DatePicker("Select Date", selection: $selectedDate, in: ...Date.now, displayedComponents: [.date])
.labelsHidden()
// Date Picker for selecting the time (Restricts to today or earlier)
DatePicker("Select Time", selection: $selectedTime, in: ...Date.now, displayedComponents: [.hourAndMinute])
.labelsHidden()
// Display selected Date & Time
Text("\(formattedDateTime)")
.font(.footnote)
.padding()
}
}
/// Formats the selected date and time for display
private var formattedDateTime: String {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.timeStyle = .short
return formatter.string(from: selectedTime)
}
}
#Preview {
HistoryPeriodView()
}
Posts under watchOS tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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.
I'm working on Apple Watch UI tests and have noticed different results between local and Xcode Cloud environments.
I tested all cases locally, and they worked fine. However, when running the tests on Xcode Cloud, some issues caused them to fail:
The test requires clicking a button to display the built-in keyboard, but on Xcode Cloud, the keyboard never appears, no matter how long I wait.
The app unexpectedly closes during testing, displaying the error message: "Failed to launch application {Your app} is not running."
These failures occurred on two different simulator destinations (Ultra 49mm 11.2 / Series 7 45mm 11.2) and can only be reproduced on specific simulators.
Has anyone encountered a similar issue?
I would like to get user's heart rate zones values in my watchOS app, is there any way to get it from HealthKit?
Furthermore, is it possible to display the Apple heart rate zones widget in my watchOS app?
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
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.
Here is the reproducible codes:
struct JumpView: View {
var body: some View {
NavigationStack {
TabView {
Text("Jump")
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button("Done") {}
}
}
}
}
}
}
Run directly in real apple watch device in watchOS 10.0+ (do not debug connecting with Xcode).
When raise your wrist the ToolBar Button will jump weirdly.
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
I'm developing a watchOS app for Watch Ultra 2 that implements water detection using CMSubmersionManager.
I would like to make it appear in the Auto-Launch settings menu, but my app is not appearing in the settings (Settings > General > Auto-Launch > When Submerged > Selected App)....
What additional steps should I take to make this work?
Environment
Device: Watch Ultra 2
watchOS: 11.2
Xcode: 16.0
Implementation
I have implemented the following as per documentation:
Added the Shallow Depth and Pressure capability and Entitlement.
Added the "Shallow Depth and Pressure" capability
Confirmed entitlement "com.apple.developer.submerged-shallow-depth-and-pressure" was automatically added
Note: I initially thought I should use "com.apple.developer.submerged-depth-and-pressure" (without "-shallow") since I'm targeting a maximum depth of 6 meters, but this resulted in compilation errors.
ref: https://developer.apple.com/forums/thread/740083
ref: https://developer.apple.com/forums/thread/735296
Added NSMotionUsageDescription and WKBackgroundModes
<key>NSMotionUsageDescription</key>
<string>Required for water detection</string>
<key>WKBackgroundModes</key>
<array>
<string>underwater-depth</string>
</array>
According to the documentation:
"It also adds your app to the list of apps that the system can autolaunch when the wearer submerges the watch."
What additional steps are needed to make the app appear in Auto-Launch settings? Has anyone successfully implemented this feature?
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!
I am working on an Apple Watch companion app to an existing live iOS app. I am utilizing the heart rate tracking for an active 'self-care' sauna session. I say self-care in quotes because it's more self-care than a workout activity, but it is closely blurring the lines between the two.
I have come to understand that if a session truly isn't a workout, then you should not use workoutSession.startActivity. However the app needs to function entirely like a workout would. This is not a meditation application. Sauna is actually just one of many activity types supported in the app.
I have tried using extended runtime session, and there have been numerous issues with doing so. It is not nearly as robust for the user. For example, the active session is not prioritized by the watch's CPU. Now playing is no longer functional. Heart rate is far more inconsistent, and this variable is as critical as if it were in a workout.
I have tried using HKWorkoutSession, however I worry the app will be rejected by doing so. This method works most accurately to collect the right data for the user, and prioritizes system resources as expected. The app can be moved to the background as expected and continue to communicate with the iOS app.
What is the best way to move forward here. It almost feels like I am operating in a grey area with no real solution in place. Any assistance is greatly appreciated as we would like to follow all guidelines while producing a high quality experience for our users.
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.
Hi I'm new to the forum,
I'm planning an app just for Apple watch, I would like to use bluetooth audio in background, how can I do it?
The messages I send via bluetooth stop as soon as the watch display turns off.
Thank you!
Nax
Got a Watch SE recently only to find out that I can't deploy apps to it from Xcode even once.
I always get the message "Connecting to Watch" and "Reconnecting to Watch".
Tried with Xcode 16 and then with 16.2. Same result.
For countless times, I have tried every possible solution posted on this forum and elsewhere but to no avail.
Filed a feedback, no reply yet from Apple.
Looks like something is seriously broken. Please fix this.
FB16122816
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 ?
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
Hi,
I've had trouble for a while now with HealthKit giving me different values if I make the request on iOS and WatchOS.
I am using the exact same method on both with the same parameters but I get vast differences in the results.
The code I am using to call HealthKit on both devices is:
let dateRange = HKQuery.predicateForSamples(withStart: Date().removeMonths(numberOfMonths: 1), end: Date().endOfDay())
let predicate: NSPredicate
predicate = NSCompoundPredicate(type: .and, subpredicates: [dateRange])
let query = HKStatisticsQuery(quantityType: HKQuantityType(.stepCount), quantitySamplePredicate: predicate, options: .cumulativeSum) { _, result, error in
if error != nil {
//print("Error fetching step count, or there is no data: \(error.localizedDescription), \(startDate) -> \(endDate)")
onComplete(0)
return
}
if let result, let sum = result.sumQuantity() {
let stepCount = sum.doubleValue(for: HKUnit.count())
DispatchQueue.main.async {
onComplete(Int(stepCount))
}
}
}
healthStore.execute(query)
}
I have tried all of the above options, cleaned cached data, restarted several times, did not work.
The tunnel connection failed while the system tried to connect to the device.
Domain: com.apple.dt.RemotePairingError
Code: 4
System Information
macOS Version 15.2 (Build 24C101)
Xcode 16.2 (23507) (Build 16C5032a)
iOs 18.1.1