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)
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I’m developing a smart alarm app that makes use of the extended runtime session. I’ve looked at the docs, and one of the background modes for Apple watch is smart alarm.
The docs also say that an extended runtime session can only be scheduled one at a time, and while the app is open, which isn’t very intuitive for an alarm app that runs on schedules.
I’ve seen other apps do something similar, but I’m trying to make this fully automated, without the user having to do too much manually to reschedule the smart alarm.
Is there no way to do this? I would’ve thought the smart alarm background modes would allow to schedule more than 1/a repeating extended runtime session.
When creating an icon using icon composer, I cant upload a build to testflight/App Store connect.
Running on device from Xcode works fine, but as soon as I archive and upload to App Store Connect, I get an error saying the icon contains an alpha channel