watchOS is the operating system for Apple Watch.

Posts under watchOS tag

156 Posts

Post

Replies

Boosts

Views

Activity

SwiftUi Picker in WatchOS throws Scrollview Error when using Digital Crown
The following WatchOs App example is very short, but already not functioning as it is expected, when using Digital Crown (full code): import SwiftUI struct ContentView: View { let array = ["One","Two","Three","Four"] @State var selection = "One" var body: some View { Picker("Array", selection: $selection) { ForEach(array, id: \.self) { Text($0) } } } } The following 2 errors are thrown, when using Digital Crown for scrolling: ScrollView contentOffset binding has been read; this will cause grossly inefficient view performance as the ScrollView's content will be updated whenever its contentOffset changes. Read the contentOffset binding in a view that is not parented between the creator of the binding and the ScrollView to avoid this. Error: Error Domain=NSOSStatusErrorDomain Code=-536870187 "(null)" Any help appreciated. Thanks a lot.
6
5
1.1k
Mar ’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
397
Mar ’25
Change app language on Apple Watch simulator
I feel a bit dumb now. I once succeeded to change the language of an app on Watch simulator. So it is possible. And I'm not able to repeat (fool of me I did not took note of how I did it). I just remember it was simply through some language settings selection, may be rebooting the Mac, but not by changing anything in code. Does someone know how to do ?
3
0
468
Mar ’25
WatchOS beta 11.4 won't install
I downloaded the iOS and iPadOS 18.4 beta and it worked. Instead on Apple Watch Series 6 it does not install. It says to connect to the Internet but I am connected. I have already tried to restart iPhone 12 pro and Apple Watch but nothing to do. I also did factory data Apple Watch but nothing changed. Apple support told me that they do not help you on betas. I also sent feedback on Apple feedback app. I do not know what to do anymore. Does anyone have the same problem as me? Can it be solved?
7
2
869
Feb ’25
Is it possible to provide an interface for real-time sleep status monitoring
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
1
0
567
Feb ’25
how to make sound appear with haptic feedback on apple watch
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)") } } }
1
0
585
Feb ’25
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
383
Feb ’25
SwiftUI DatePicker
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() }
2
0
367
Feb ’25
Inconsistent behavior across different test environments and simulators
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?
1
1
438
Feb ’25
SwiftUI: toolbar jump weirdly in AppleWatch
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.
1
0
360
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
How to support foregroundColor (deprecated) and foregroundStyle in watchOS 9/10?
In my Watch app on watchOS 9 I was using .foregroundColor(myColour) to colour the text in a widgetLabel on a corner complication like this: let myColour: Color = functionThatReturnsAColorObjectConstructedLike Color.init(...) // green .widgetLabel { Text(myText) .foregroundColor(myColour) } It worked fine; the widget label was green. Now, in watchOS 10, I see that foregroundColor() is being deprecated in favour of foregroundStyle(), and I can use .foregroundStyle(.green), and - importantly - foregroundStyle() is only available on watchOS 10 and newer. myColour is calculated depending on some other info, so I can't just write .green, and when I use .foregroundStyle(myColour) the widget label comes out as white every time, even if I set myColour = .green. I think I have to use some sort of extension to pick the right combination, something like: extension View { func foregroundType(colour: Colour, style: any ShapeStyle) -> some THING? { if #available(watchOS 10.0, *) { return foregroundStyle(style) } else { return foregroundColor(colour) } } } // Usage let myStyle: any ShapeStyle = SOMETHING? ... .widgetLabel { Text(myText) .foregroundType(colour: myColour, style: myStyle) It doesn't work. I just can't figure out what should be returned, nor how to return it. Any ideas?
3
2
3.5k
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
689
Feb ’25
There seems to be a bug with digitalCrownAccessory
After reading the documentation on .digitalCrownAccessory, I am under the impression that the system should know to show your accessory and hide your accessory according to whether the crown is being rotated. I have noticed this is not the case. I have also tried a few work arounds with no luck. Here is a simplified version of my code. I have recorded a video of the issue I am seeing, but I can't upload it, so I have attached some screenshots instead. Expected result: After rotating the crown, the accessory image should disappear along with the vertical system scroll bar. Actual result: After rotating the crown, the vertical system scroll bar disappears but the accessory image stays behind. Versions: Sonoma 14.6.1 Xcode 16 Beta 5 (and Xcode 15.4) Apple Watch Ultra 2 watchOS 11 (device and simulator) Starting file (main): import SwiftUI @main struct DummyWatch_Watch_AppApp: App { var body: some Scene { WindowGroup { ContentView() } } } ContentView.swift: import SwiftUI struct ContentView: View { @State var crownValue: CGFloat = 0 var body: some View { VStack { Text("Hello, world!") } .focusable() .digitalCrownRotation($crownValue, from: 0, through: 10, by: 0.1, sensitivity: .low, isContinuous: false) .digitalCrownAccessory { Image(systemName: "speaker.fill") } .padding() } } Images: Scrolling: Speaker wont go away:
1
1
516
Feb ’25