Build a workout app for Apple Watch

RSS for tag

Build a workout app for Apple Watch

View Session

Posts under wwdc21-10009 tag

15 Posts
Sort by:
Post not yet marked as solved
1 Replies
579 Views
I'm developing a workout app and the app uses routeBuilder to save the workout route along with workout data. The app did as expected (retrieves and saves GPS data) when app is in foreground mode and even in background mode when Apple Watch display is ON ... the problem is when the watch enters the dim state (blur on Always On) then GPS data is received 10-15 more seconds and after that the app stops receiving updates until display is ON again. Background Mode - Location Updates and Workout Processing capabilities are ON , allowsBackgroundLocationUpdates is true, Location When In Use permission is granted. App works fine on simulator. The previous behavior is on an Apple Watch 6, 44mm WatchOS 7.5 (Watch only app)
Posted
by
Post not yet marked as solved
0 Replies
605 Views
Hi Team, I used below code to get active window details. but unable to find title of it. Can you please help me on it. C# based code in Mac var foreground_app = NSWorkspace.SharedWorkspace.FrontmostApplication; foreground_app contains active application details. but i am not able to identify active window details . guide me which property or function i need to use to get active window title details EX: i opened Numbers, below condition will trigger if(foreground_app.LocalizedName.ToLower().Contains("numbers")) { /// }
Posted
by
Post not yet marked as solved
1 Replies
879 Views
I'm working on updating my Apple Watch workout app to support always on display low frequency modes in watchOS 8. I'm using the sample project (https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/build_a_workout_app_for_apple_watch) as a guide but am hitting some problems with getting the workout metrics updating while in the Always On state. The timer correctly hides the sub seconds but the time and other health metrics do not update while the Always On mode is toggled in the simulator. This sample project used to work during the first Xcode beta but is no longer working. Does anyone know if there are any new requirements aside from using the TimelineView? Thanks for the help!
Posted
by
Post not yet marked as solved
0 Replies
386 Views
I have just decided I want to make a watch app and am trying to familiarize myself with Xcode and Swift. So I decided to follow the Workout app for watchOs tutorial and the tutorial used this block of code. Text(      Measurement(       value: 47,       unit: UnitEnergy.kilocalories      ).formatted(        .measurement(         width: .abbreviated,         usage: .workout,         numberFormat: .numeric(          precision: .fractionLength(0)         )        )       )     ) However when I try to use this code I get the following error. Value of type 'Measurement<UnitEnergy>' has no member 'formatted' Im using XCode Version 12.5.1 Any help is appreciated!
Posted
by
Post not yet marked as solved
0 Replies
338 Views
Problem: SwiftUI render wrong size on old device like Apple Watch Series 4. The height was be cut, not well render as series 6 or simulator. Check the screenshots. BTW: But it works well both on watch series 6 real device or simulator. Reproduce: Download “Build a Workout App for Apple Watch”, run the code on a real device of watch series 4 https://developer.apple.com/videos/play/wwdc2021/10009/ On Watch4-44 mm (first line be clip) On Simulator or watch 6.
Posted
by
Post not yet marked as solved
1 Replies
493 Views
If I use the Apple training app for indoor swim workouts, I can see the distance by each swimming stroke style later in the Fitness app. However, if I build my own swim app, the distance by stroke style is not listed. What do I have to add, to have it listed there? The information are saved correct in the HKWorkoutEvent array in the workout.
Posted
by
Post marked as solved
1 Replies
529 Views
I’m trying to understand how often I can get updates on stuff like Heart Rate , Oxygen Saturation and movement. I'm building a third party app that detects sleep phases so I need it to monitor all night (5-8 hours) and get an update at least every minute. I don’t think I can use the HKWorkoutType class/subclass since it’s not really a workout, and I was told Apple might reject my application. I understand I should be able to get something via enableBackgroundDelivery Another post here suggests to use ExtendedRuntimeSessions Can anyone give me some directions on the feasibility? Is there any way to access Heart Rate directly, without using the WorkoutSession classes? PS What about movement? Is accessing the accelerometer easier?
Posted
by
Post not yet marked as solved
1 Replies
265 Views
I am trying to share the standard “Item” database supplied when you check the Core Data box when building an app. I have gotten to the point where I am using a shared Persistence file and data model between the IOS device and the Watch. I can add data from both sides but it appears that the data is not “syncing”. I am using a shared app group id in the Persistence file. why isn’t it syncing? any ideas would be appreciated.
Posted
by
Post not yet marked as solved
0 Replies
235 Views
I am trying to display the steps of a user to a metrics view screen in an apple watch. Here is how I try to get the steps: KQuantityType.quantityType(forIdentifier: .stepCount):         let stepCount = HKUnit.meter()         self.stepCount = statistics.sumQuantity()?.doubleValue(for: stepCount) ?? 0         print("step count: \(self.stepCount ?? 0)") Where stepCount is a published variable. I then try to display the steps: Text("\(workoutManager.stepCount!) steps") I am not able to see the steps in a log when I try to print or through Text....any ideas on how to do this?
Posted
by
Post not yet marked as solved
3 Replies
417 Views
Can Apple Watch provide complete data on the heartbeat for thousands of seconds during the workout or when using the "Breathe" app? When I exported data from Apple Health it shows the following data. The rows 195, 196 & 197 are measurements taken through the "Breathe" app. Thank you for your answers,
Posted
by
Post not yet marked as solved
0 Replies
103 Views
Hello. My Apple Watch Health App is not launching is stuck on the loading screen forever. In the debug console, This message is displayed. `SwiftUI/EnvironmentObject.swift:70: Fatal error: No ObservableObject of type WorkoutManager found. A View.environmentObject(_:) for WorkoutManager may be missing as an ancestor of this view. 2022-04-19 10:27:58.865727-0400 FitnessFriend WatchKit Extension[65428:475974] SwiftUI/EnvironmentObject.swift:70: Fatal error: No ObservableObject of type WorkoutManager found. A View.environmentObject(_:) for WorkoutManager may be missing as an ancestor of this view. (lldb)  If anybody could help, it would be greatly appreciated.
Posted
by
Post not yet marked as solved
0 Replies
93 Views
I am trying to pair a new apple watch I got, iwatch 3 to my iphone 11 pro max and it keeps saying I am not connected to the internet which of course I am
Posted
by
ymg