Post not yet marked as solved
Hi! So after the public beta for iOS 16 rolled out I updated my phone because I wanted to try out some of its new features. Sadly, my banking app didn't like the new beta and I had to wait 5-10 minutes just to check my balance. Because of that I decided to restore my phone from an encrypted backup which I created earlier.
Ever since then, the Fitness app won't load. I also have an Apple Watch series 4 but the Fitness app works perfectly on it. It just doesn't work on my phone.
Also, I have the same problem with the Health app. I can open the app, but it doesn't show any data. And I don't understand this, because I created an encrypted backup because I didn't want to lose any of my Health data. And not only that I can't see my old data, my phone won't create any new data as well. For example, I have the sleep monitoring feature turned on, but the app won't create the data for it, so I have no sleeping data.
I tried to force close the apps and restart them, and I also restarted my phone several times, but it hasn't changed anything.
I attached two screenshots about my problems.
Thank you for the answers in advance!
(I tried posting this here as well, but my post got removed because the text contained the word "beta" in it.)
Post not yet marked as solved
Hello:
About a week ago I noticed that the "Health & Fitness" folder I created to hold all of my health apps on my home screen entirely disappeared. I keep all of my apps nicely organized into folders on my home screen based on category. All of my other folders remained. The health apps that were in the folder ARE NOT visible anywhere on my home screens, however, THEY ARE able to be found and used by swiping left to my app library search screen. I can search for the apps there and use them. This is bizarre to me as I would think that if the apps were still downloaded onto my phone, then they would appear somewhere on a home screen even if the folder they were in somehow got deleted. Is there a way to get this folder back or at least have the apps populate back on my home screen so that I can create another folder and not have to search for them every time? I have an iPhone 13 Pro running iOS 15.5 Thanks!
Post not yet marked as solved
Hi,
With the new WatchOS 9 , the following article watchOS 9 Preview - Apple says : "Fitness+ subscribers who use AirPlay to see their workouts can now get real-time personal metrics from their Apple Watch on compatible displays." .An other article watchOS 9 delivers new ways to stay connected, active, and healthy - Apple (MA)says :"Fitness+ subscribers without Apple TV can now use AirPlay to stream workouts and meditations with on-screen metrics to compatible third-party TVs and devices, allowing them to train anywhere, anytime."
I tried this with my macbook pro 2018 , MacOS Ventura , WatchOS 9 using airplay and it doesn't work .Are macs compatible devices for this feature ? Is it a matter of software update ?
Thank you very much !
Post not yet marked as solved
What are the sensors type for the SpO2 measurement?
Does Watch 7 have the temperature/touch/pressure sensor to detect whether the measuring object is human skin? So as to activate the start of SpO2 measurement?
Post not yet marked as solved
I'm using watchOS 9 beta 2 and I'm not getting the new running metrics in my workout app.
Using HKLiveWorkoutDataSource attached to a HKWorkoutBuilder
ActivityType is running
Tried enabling the collection of the new metrics
According to Jorge M in the WWDC labs:
"Yes, the new running metrics are also available for 3rd party applications. If you are using an HKLiveWorkoutDataSource attached to a HKWorkoutBuilder in your application, the new metrics would be collected by default."
The Health app does not show any Related Samples for these types. Am I doing something wrong or are they not available yet to 3rd party workouts? I do see them for the Apple Workout app.
Post not yet marked as solved
Would be Watch OS App developer here.
Is an app like this possible?
Is an iOS app able to 'catch' the heart rate continuously from the Apple Watch which is running an Apple Workout App workout?
Thanks for your answers!
Post not yet marked as solved
I deleted the Fitness app from my iPhone 13, and now I wanted to re-install the same, but whenever I'm trying the to do so, it's keeps on stating the same error
This app requires specific features not available on this device
Can anyone pls help me out on this one.
Post not yet marked as solved
let stagePredicate = HKCategoryValueSleepAnalysis.predicateForSamples(.equalTo,value: .asleepREM)
let queryPredicate = HKSamplePredicate.sample(type: HKCategoryType(.sleepAnalysis), predicate: stagePredicate)
let sleepQuery = HKSampleQueryDescriptor(predicates: [queryPredicate], sortDescriptors: [])
do{
let sleepSample = try await sleepQuery.result(for: store)
print("sleep sample ")
print(sleepSample)
with health app on iOS ,
it says I did rem sleep for 59 minutes.
but all sum of sleep sample time is not 59 but 3.7hours.
time is also not accurate.
sleepSample log is as below
what may be the problem?
Post not yet marked as solved
Is it possible to set TotalDistance for the sorts of HKSampleQueryDescriptor?
In HKSampleQuery, I can set TotalDistance as follows.
let sort = NSSortDescriptor(key: HKWorkoutSortIdentifierTotalDistance, ascending: false)
let type = HKWorkoutType.workoutType()
let query = HKSampleQuery(sampleType: type, predicate: nil, limit: 0, sortDescriptors: [sort] ){
(query, results, error) -> Void in
}
I want to create a SortDescriptor for HKSampleQueryDescriptor.
When I set HKWorkout.totalDistance to parameter in SortDescriptor, the compile error occurred.
let sort = SortDescriptor(\HKWorkout.totalDistance, order: .forward)
// Error: "No exact matches in call to initializer"
I know that HKWorkout.totalDistance is deprecated.
Isn't it recommended to set TotalDistance to sort?
I'm expecting that on iOS 16, I can get my workouts in heart rate order, is this a mistake?
Post not yet marked as solved
We are building an app, and connecting Apple Health, but you are not able to disconnect it.
Post not yet marked as solved
They said that due to the health features (There is a pedometer. Pharmacy and hospital locations are there.) in our application, they cannot publish it from my personal account. If we open an account on behalf of our sole proprietorship, will our application be published?
Sorry for my bad English.
Post not yet marked as solved
Hi,
I'm trying to implement HealthKit Background delivery for my app and I'm getting a strange behavior where the HKObserverQuery updateHandler is getting fired twice. I'm running Xcode 13.4 & iOS 15.5.
2022-06-10 10:05:58.725006+0200 Cori[79737:8949689] [HealthKit] Run Background Delivery Handler
2022-06-10 10:05:58.726283+0200 Cori[79737:8949689] [HealthKit] Run Background Delivery Handler
2022-06-10 10:05:58.736475+0200 Cori[79737:8949700] [HealthKit] New data: [200 mg/dL 4680E3F5-034A-4AED-843C-9066532AD459 "Salud" (15.5), "iPhone14,2" (15.5)metadata: {
2022-06-10 10:05:58.736632+0200 Cori[79737:8949700] [HealthKit] 1 new HKQuantityTypeIdentifierBloodGlucose samples
2022-06-10 10:05:58.736926+0200 Cori[79737:8949689] [persistence] HealthKit: Start import to Core Data
2022-06-10 10:05:58.737116+0200 Cori[79737:8949700] [HealthKit] New data: [200 mg/dL 4680E3F5-034A-4AED-843C-9066532AD459 "Salud" (15.5), "iPhone14,2" (15.5)metadata: {
2022-06-10 10:05:58.737985+0200 Cori[79737:8949689] [persistence] HealthKit: 1 samples of type HKQuantityTypeIdentifierBloodGlucose not from this app!
2022-06-10 10:05:58.753583+0200 Cori[79737:8949689] [persistence] HealthKit: Start batch insert request.
2022-06-10 10:05:58.753630+0200 Cori[79737:8949700] [HealthKit] 1 new HKQuantityTypeIdentifierBloodGlucose samples
2022-06-10 10:05:58.753873+0200 Cori[79737:8949689] [persistence] HealthKit: Start import to Core Data
2022-06-10 10:05:58.754019+0200 Cori[79737:8949689] [persistence] HealthKit: 1 samples of type HKQuantityTypeIdentifierBloodGlucose not from this app!
2022-06-10 10:05:58.754076+0200 Cori[79737:8949689] [persistence] HealthKit: Start batch insert request.
2022-06-10 10:05:58.759208+0200 Cori[79737:8949701] [persistence] HealthKit: Successfully imported data.
2022-06-10 10:05:58.759669+0200 Cori[79737:8949701] [persistence] HealthKit: Successfully imported data.
This is my code:
App Delegate
extension AppDelegate {
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
if settings.syncHealthKit {
HealthKit.shared.setUpBackgroundDelivery()
}
return true
}
HealthKit Class
class HealthKit: ObservableObject {
private let logger = Logger(subsystem: "com.ChubbyApps.Diabetes", category: "HealthKit")
private var dataController: DataController = .shared
private var ajustes: AjustesModel = .shared
public let isAvailable = HKHealthStore.isHealthDataAvailable()
private lazy var isAuthorized = false
// MARK: - Properties
private var anchor: HKQueryAnchor? {
get {
guard let data = NSUbiquitousKeyValueStore.default.object(forKey: Keys.HKAnchor) as? Data else {
return nil
}
do {
return try NSKeyedUnarchiver.unarchivedObject(ofClass: HKQueryAnchor.self, from: data)
} catch {
logger.error("Unable to unarchive \(data): \(error.localizedDescription)")
return nil
}
}
set(newAnchor) {
guard let newAnchor = newAnchor else {
return
}
do {
let data = try NSKeyedArchiver.archivedData(withRootObject: newAnchor, requiringSecureCoding: true)
NSUbiquitousKeyValueStore.default.set(data, forKey: Keys.HKAnchor)
} catch {
logger.error("Unable to archive \(newAnchor): \(error.localizedDescription)")
}
}
}
// MARK: - Initializers
static let shared = HealthKit()
// MARK: - Public Methods
public func requestAuthorization() async -> Bool {
guard isAvailable else { return false }
do {
try await HKStore.requestAuthorization(toShare: types, read: types)
self.isAuthorized = true
return true
} catch let error {
self.logger.error("An error occurred while requesting HealthKit Authorization: \(error.localizedDescription)")
return false
}
}
// MARK: - Background
func setUpBackgroundDelivery() {
let query: HKObserverQuery = HKObserverQuery(sampleType: glucose, predicate: nil, updateHandler: self.backgroundDeliveryHandler)
HKStore.execute(query)
HKStore.enableBackgroundDelivery(for: glucose, frequency: .immediate) { success, error in
if success {
self.logger.debug("Enabled background delivery of stepcount changes")
} else {
if let theError = error {
self.logger.debug("Failed to enable background delivery of stepcount changes. Error: \(theError.localizedDescription)")
}
}
}
}
func backgroundDeliveryHandler(query: HKObserverQuery!, completionHandler: HKObserverQueryCompletionHandler!, error: Error!) {
self.logger.debug("Run Background Delivery Handler")
self.anchoredQueryFor(types)
completionHandler()
}
private func anchoredQueryFor(_ tipos: Set<HKSampleType>) {
var queryDescriptors = [HKQueryDescriptor]()
for type in tipos {
queryDescriptors.append(HKQueryDescriptor(sampleType: type, predicate: nil))
}
let anchoredQuery = HKAnchoredObjectQuery(
queryDescriptors: queryDescriptors,
anchor: anchor,
limit: HKObjectQueryNoLimit) { _, newSamples, _, newAnchor, error in
if let error = error {
self.logger.error("HKAnchoredObjectQuery error: \(error.localizedDescription)")
return
}
self.anchor = newAnchor
guard let samples = newSamples as? [HKQuantitySample] else { return }
guard !samples.isEmpty else { return }
self.logger.debug("New data: \(samples.debugDescription)")
for type in types {
let filteredSamples = samples.filter({ $0.quantityType == type })
if !filteredSamples.isEmpty {
self.logger.debug("\(filteredSamples.count) new \(type.debugDescription) samples")
Task {
do {
try await self.dataController.importHealthKitSample(filteredSamples, type: type)
} catch {
self.logger.error("importHealthKitSample error: \(error.localizedDescription)")
}
}
}
}
}
HKStore.execute(anchoredQuery)
}
Post not yet marked as solved
I want to add segments into a running HKWorkout. My understanding is that I should use the addWorkoutEvents method in my HKWorkoutBuilder. Here is a sample of my code:
func saveSegment(forStep step: GymWorkoutEventStep) {
let dateInterval = DateInterval(start: step.startDate ?? Date(), end: Date())
let metadata = [
HKMetadataKeyWasUserEntered: true
]
let event = HKWorkoutEvent(type: .segment, dateInterval: dateInterval, metadata: metadata)
builder?.addWorkoutEvents([event], completion: { success, error in
print(success ? "Success saving segment" : error.debugDescription)
})
}
I’m trying to implement the same feature that the native Apple Watch “Workout” app has by adding a segment when a user double taps the screen. My code seems to work as I see “Success saving segment” in the console. However, once the workout is finished, the Apple Fitness app doesn’t show these segments. What am I missing? Also, is there a way to add distance and pace to each segment using MetadataKey’s or is this not an option?
Thanks for any help you can provide.
Post not yet marked as solved
we are planning to develop a new module on our rewarding system to reward our customers on their physical activities "number of steps" received from the Apple Health and Fitness API.
the customers will have to consent the access to their health app to allow the integration ofcourse.
the idea is to allow the customer to participate in a weekly competition, where we'll be counting the number of steps of each participants and accordingly rewards the top 3 participants.
my question here, will apple allow us to store/count the customers' number of steps after getting the proper consent.
if yes, than what might be the further limitations/restrictions on processing such data?
Post not yet marked as solved
Hi all,
I am currently making a fitness app and want to replicate the way Apple incorporate medals in their Fitness app.
They have a page called awards and it looks like a collection view of different medals that the user can unlock. Once unlocking a medal the user can tap on the medal and it opens to a full screen intractable scene where the user can rotate the medal etc.
I have had a play around with SceneKit and managed to get a medal loaded into a scene and display it in the app. However my functionality does not look as smooth or as polished as Apples.
Does anyone have any idea on how they have managed to present all of the different Scene-kit scenes in a collection-view for example? Or how they have achieved the smooth transition between tapping on the medal in the collection-view and the scene.
I guess this is created using SwiftUI. Can this be replicated in Storyboards?
Thanks!
Post not yet marked as solved
Can we access HRV data in real time on watchos ?
Post not yet marked as solved
Install app on phone and watch
Power the watch off
Run the app on the phone.
WCSession.default.isWatchAppInstalled == true
WCSession.isSupported() == true
WCSession.default.isPaired == true
WCSession.default.activationState == .activated
Now I try to run HKHealthStore startWatchApp.
The startWatchApp method's completion never fires.
I'd like to detect that the watch is powered off, so then I do not try to run the startWatchApp method. I can't see a way to detect that the watch is powered off.
Alternatively - I'd like startWatchApp to quickly fail, or - to have some way of cancelling it if it doesn't return quickly.
Any ideas please?
Post not yet marked as solved
The linked article explains the walking steadiness.
https://support.apple.com/en-us/HT212503
I was wondering if i can read this data myself, track it myself and save it myself in my own app. Or if this algorithm and data is locked and unaccessable.
Thank you for any help.
Post not yet marked as solved
I can able to get my health data list from health kit. I used below code to get my today's step count :
`func getTodaysSteps(completion: @escaping (Double) -> Void) {
let stepsQuantityType = HKQuantityType.quantityType(forIdentifier: .stepCount)!
let now = Date()
let startOfDay = Calendar.current.startOfDay(for: now)
let predicate = HKQuery.predicateForSamples(
withStart: startOfDay,
end: now,
options: .strictStartDate
)
let query = HKStatisticsQuery(
quantityType: stepsQuantityType,
quantitySamplePredicate: predicate,
options: .cumulativeSum
) { _, result, _ in
guard let result = result, let sum = result.sumQuantity() else {
completion(0.0)
return
}
completion(sum.doubleValue(for: HKUnit.count()))
}
healthStore.execute(query)
}`
But i have one more health data of my brother, where he invited me to see his health data in my real device. Now i was not able to read / get his health data. Is there any way to get that.
Any solution would be great ...!
Post not yet marked as solved
What are the various scenarios when Apple records HRV(Heart Rate Variability) automatically in the background ?
Apple definitely computes HRV when someone uses Breathe App (in Mindfulness) on their Apple Watch and when we closely look at the details of data collected in HealthKit app, it depicts Algorithm Version as 2 But Apple also records HRV in some other scenarios which depicts Algorithm Version as 1. What are those scenarios?