watchOS is the operating system for Apple Watch.

Posts under watchOS tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

WCSessionUserInfoTransfer. isTransferring can not be updated when transfer was completed
Hi, I am new to swift and IOS development, I was developing an app which can be used to communicating between Apple Watch and iPhone. Something strange occurred when I was trying to observe the status of the message(UserInfo) sent by func transferUserInfo(_ userInfo: [String : Any] = [:]) -> WCSessionUserInfoTransfer. I was trying to observe isTransferring(a boolean value) in WCSessionUserInfoTransfer which was returned by the function mentioned above, but it seems cannot be updated even if the message queue was empty, it seems to always be True. Here is my sample code: let transfer = session.transferUserInfo(message) if transfer.isTransferring { Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { timer in print("Queued message count: \(self.session.outstandingUserInfoTransfers.count), isTransferring:\(transfer.isTransferring)") if !transfer.isTransferring { timer.invalidate() // irrelevant codes... } } } else { // other irrelevant codes... } Appreciate if anyone can help me out of this problem. Best wishes.
0
0
419
Nov ’24
Apple Watch Modular Ultra issue for YEARS!
Hi. I’m not sure where to post it, but after 1.5 years with the AWU2 the main Watch face is still bugged, missing seconds (two digit) in format. In the attached example it shows “06:30:5” for 10 seconds until it hits ”06:31:00”. I’m not sure if it’s only related to Danish AWU’s. But it is so annoying, and has forced me to change watch to Garmin in the past. PLEASE FIX IT, please please.
1
0
377
Dec ’24
Is there a way to disable button tap feedback in watchOS double-tap gesture?
First post here! Is there a way to reduce the number of haptic feedback for double tap on primary button? Context: Double tap is awesome. Two haptic actuations are given to the gesture to let the user know that the gesture is "received" then a third haptic feedback is given shortly after to signal the primary button is tapped. Is there a way to disable the third haptic feedback. In other words make primary action "silent"? I have tested a number of apps that supports double tap, it seems to me that the triple tap is a system level default, and it cannot be changed. Any help would be greatly appreciated.
0
0
359
Nov ’24
HKWorkoutSession.sendToRemoteWorkoutSession doesn't report success or failure
We are seeing an issue where sending data using the asynchronous method HKWorkoutSession.sendToRemoteWorkoutSession(data: Data) will never return in some cases (no success nor failure). This issue is happening for roughly 5% of Workouts started and will stay broken for the whole workout. The other 95% of the workouts, the connection works flawlessly. This happens on both watchOS 10 and 11, and with phones running iOS 17 or 18. The issue is quite random and not reproducible. Our app has thousands of workouts a day that use the workout session workout data send, with constant messages being send every few seconds. In some of those 5% cases the "sendToRemoteWorkoutSession" will throw way later, like 30+ minutes later, if the watch app is awake long enough to capture a log of a failure. Our code uses the same flow as in the sample project: https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app Here is some sample code, which is pretty simple. Setup code: let workoutSession = try HKWorkoutSession(healthStore: healthStore, configuration: configuration) workoutSession.delegate = self activeWorkoutSession?.startMirroringToCompanionDevice { success, error in print("Mirroring started on companion device: \(success), error: \(error)") } workoutSession?.prepare() then later we send data using the workout session: do { print("Will send data") try await workoutSession.sendToRemoteWorkoutSession(data: data) print("Successfully sent data") // This nor the error may be called after waiting extensive amounts of time } catch { print("Failed to send data, error: \(error)") // This nor the success may be called after waiting extensive amounts of time } So far, the only fix is to restart the phone and watch at the same time, which is not a great user experience. Is anyone else seeing this issue? or know how to fix this issue?
0
0
413
Nov ’24
Bring iOS app to foreground from Apple Watch app
Exploring Live Activity feature for Apple Watch right now and found that it has this default view with "Open on iPhone" button when you tap Live Activity. That button perfectly brings iOS app to foreground as if you tapped iOS's Live Activity. Is there a way to mimic that behavior from inside Watch app code? From inside WKApplicationDelegate, for example Tried openSystemURL but it seems lile it's only available for tel or sms links
1
0
442
Nov ’24
The screen of the watchOS app automatically turns off and pauses operation.
I developed a watchOS app to capture gyro data, save it in real-time as a CSV file, and send it to an iOS app. However, when I start writing with the watch on, the screen dims, and it stops working. It only resumes operation when I tap the screen again. Is there a way to let it run in the background and transmit files in real-time, even when the screen is off?
0
1
555
Nov ’24
Sharelink in WatchOS and Messages App
I’m relatively new to SwiftUI, so I’ve got a pretty basic question here. In my watchOS app, I’m using ShareLink to share a string of text to the Mail and Messages apps. Mail shows up in the ShareLink sheet just fine, but Messages doesn’t appear. What’s odd is that when I run the app in Xcode’s preview or in the Simulator, Messages does show up as a sharing option… So now I’m wondering if this is just a quirk with my device or if Apple doesn’t actually support sharing text to Messages from third-party watchOS apps yet? I know some Apple Watch apps (like Contacts) do support sending text/files to Messages, so I’m curious if anyone’s had a similar experience or knows more about this. Any insights would be super helpful!
7
2
489
Dec ’24
Ios 18.2 beta 2 - unable to pair Apple Watch - iPhone out of date Error
I'm unable to pair my Apple Watch Ultra (watch os 11.1 GA) onto Ios 18.2 beta 2 (had same issue with beta 1). I get a Phone out of date Error and was wondering if someone had a workaround. I tried backing up my phone, restoring on a 18.1 GA phone and tried to pair there (in hopes of later restoring backup on 18.2 b2) but I got the same error on 18.1 after the restore; I'm guessing somewhere in the backup it incorrectly restores the iOS version. I am able to pair watch on a non restored 18.1. HELP!
1
0
662
Nov ’24
watchOS App crashes only in Production/TestFlight
Hello, Our watchOS App users on Apple Watch3 are experiencing crashes. PROBLEM only happens in production/testflight apps. app crashes immediately on launch if I build the app in Apple Watch3 device from a local machine, the app runs fine. app runs fine on an Apple Watch3 simulator What could possibly cause crashes only on Production/TestFlight while working fine on local builds? Any advice about what I could do to narrow down the cause would be greatly appreciated. THINGS I'VE TRIED Tried disabling Dead Code Stripping option in the Build Settings without any success. ENVIRONMENT Apple Watch 3, most of them on watchOS 8.8.1(19U512) our App is in SwiftUI our App's minimum supported OS version is watchOS 8.0 Thank you.
1
0
337
Nov ’24
Defer system gestures in a WatchKit app
Hi, I'm making a WatchKit game app with SpriteKit and Objective-C, and I'm encountering an annoyance where system gestures, namely long-pressing the top and bottom edges to pull Notification/Control Center, interfere with the controls of the game. In iOS, this can be mitigated by using overriding preferredScreenEdgesDeferringSystemGestures in UIViewController, but I couldn't find any equivalent API in any WatchKit class, and searching for similar symbols only yielded a single private API (-[_UISystemAppearanceManager screenEdgesDeferringSystemGestures]) that isn't ever called on watchOS. Any idea how to achieve a similar effect on watchOS?
1
0
405
Nov ’24
Screen on Apple watch turn off even when "Always On" is active
Our company has developed a product available, which measures body composition. During the measurement process, lasting 40 seconds, we require the device screen to remain illuminated. We are actively using the "Always On" feature and have set the timer on the watch to 70 minutes to prevent the screen from dimming. However, we are encountering issues where the screen may still turn off during the measurement. Could you please provide guidance on how to keep the screen active with backlighting across all Apple Watch models during measurements?
2
0
713
Nov ’24
FocusState and pickers error
Hello, since the last version of iOS and WatchOS I have a problem with this code. This is the minimal version of the code, it have two pickers inside a view of a WatchOS App. The problem its with the focus, I can't change the focus from the first picker to the second one. As I said before, it was working perfectly in WatchOS 10.0 but in 11 the problems started. struct ParentView: View { @FocusState private var focusedField: String? var body: some View { VStack { ChildView1(focusedField: $focusedField) ChildView2(focusedField: $focusedField) } } } struct ChildView1: View { @FocusState.Binding var focusedField: String? @State private var selectedValue: Int = 0 var body: some View { Picker("First Picker", selection: $selectedValue) { ForEach(0..<5) { index in Text("Option \(index)").tag("child\(index)") } }.pickerStyle(WheelPickerStyle()).focused($focusedField, equals: "first") } } struct ChildView2: View { @FocusState.Binding var focusedField: String? @State private var selectedValue: Int = 0 var body: some View { Picker("Second Picker", selection: $selectedValue) { ForEach(0..<5) { index in Text("Option \(index)").tag("childTwo\(index)") } }.pickerStyle(WheelPickerStyle()).focused($focusedField, equals: "second") } } When you do vertical scrolling on the second picker, the focus should be on it, but it dosnt anything. I try even do manually, setting the focusState to the second one, but it sets itself to nil. I hope that you can help me, thanks!
4
0
912
Dec ’24
Lose my variables when my watch turn off
Hello guys, I have such a big coding problem since a half year now about data saving. I have a fitness app where we can add our exercices depend of the muscle, so you can choose it and then select your weight and number of repetitions and valid your exercise. But when I do my exercises and my watch screen is also turn off, my muscle and muscleExercise variables are going back to their default value. Here some code for you : @EnvironmentObject var dataManager: DataManager @Environment(\.modelContext) private var context @AppStorage("savedGroupName") private var savedGroupName: String = "" @AppStorage("savedExerciceName") private var savedExerciceName: String = "" @State var groupName: String = "À choisir" @State var ExerciceChoose: String = "À choisir" I use my variables here : HStack { Text("Muscle:") Spacer() NavigationLink(destination: MusclesView()) { Text(savedGroupName.isEmpty ? "À choisir" : savedGroupName) } .buttonStyle(PlainButtonStyle()) } .onAppear { savedGroupName = groupName } HStack { Text("Exercise:") Spacer() NavigationLink(destination: MuscleExercicesView(groupName: groupName, ExerciceChoose: ExerciceChoose)) { Text(savedExerciceName.isEmpty ? "À choisir" : savedExerciceName) } .onAppear { savedExerciceName = ExerciceChoose } .buttonStyle(PlainButtonStyle()) } The value of my muscle variable is taking in an other view : struct MusclesView: View { let muscleGroup = ExerciceData.muscleGroups var body: some View { NavigationStack { List(muscleGroup, id: \.name) { group in NavigationLink(destination: MuscleExercicesView(groupName: group.name, ExerciceChoose: "À choisir")) { Text(group.name) } } } } } #Preview { MusclesView() } and the value of the exerciseMuscle variable is also taking in an other view : ```import SwiftUI struct MuscleExercicesView: View { let exerciceGroup = ExerciceData.muscleGroups @State var groupName: String @State var ExerciceChoose: String var body: some View { if let group = ExerciceData.muscleGroups.first(where: { $0.name == groupName }) { List(group.exercices, id: \.id) { exercice in NavigationLink(exercice.name, destination: CurrentInformationsView(groupName: groupName, ExerciceChoose: exercice.name)) } /*.onTapGesture { print("Selected exercise: \(ExerciceChoose) for muscle group: \(groupName)") }*/ .navigationTitle(Text("Exercices pour \(groupName)")) } else { Text("Aucun exercice trouvé pour \(groupName)") .navigationTitle(Text("Erreur")) } } } #Preview { MuscleExercicesView(groupName: "Pectoraux", ExerciceChoose: "À choisir") } I tried many things (like userDefault, put my values in an array to save it etc..) to keep my variables with the same value during the session but nothing works. I wish I could have some help from you guys. Have a good day ! Cyrille
0
0
274
Oct ’24
Data sharing between WidgetWatchExtension and watchOS/iOS app
When I try to access the data in my IntentTimelineProvider in the recommendations function using App Groups, it is always empty "no data". func recommendations() -> [IntentRecommendation<IndicatorIntent>] { if let sharedUD = UserDefaults(suiteName: "group.measurements") { let jm = JanitzaMeasurementValue(identifier: "1", display: "2") let intent = IndicatorIntent() intent.indicatorWidgetData = jm let desc = sharedUD.string(forKey: "string") ?? "no data" return [IntentRecommendation(intent: intent, description: desc)] } return [] } Although I write this in both the watchOS and iOS app using App Groups. if let sharedUD = UserDefaults(suiteName: "group.measurements") { sharedUD.set("test", forKey: "string") } What is the right way to dynamically implement the widgets for Complications in watchOS? Like for example in Shortcuts App. **Thanks for support **
3
2
459
Nov ’24
How to make a FocusState on WatchOS
Hey guys, I'm creating a fitness app on WatchOS and I need to realize a focus on a variable but it doesn't work. I will show you my code to understand the problem : @State var WeightChoose: Double = 0.0 @FocusState private var isWeightActive: Bool var body: some View { HStack { Text("Poids:") Spacer() Text("\(String(format: "%.0f", WeightChoose)) KG") .focused($isWeightActive) .foregroundColor(isWeightActive ? .green : .white) .digitalCrownRotation($WeightChoose, from: 0.0, through: 300.0, by: 1.0, sensitivity: .medium) .animation(.easeIn(duration: 1), value: WeightChoose) .padding() Here my code don't show me any error but the focus doesn't work at all. Before, I used the old way to focus with @State private var isWeightActive = false instead of @FocusState and .focusable(true) { focused in isWeightActive = focused } Instead of .focused() But now the .focusable() method is depreciated since watchOS 8 and we have to go on FocusState and .focused but it doesn't work for my code. If you could help me with that it would be awesome. Thank you Cyrille
1
0
365
Oct ’24