Hello,
With reference to HealthKit - Clinical Health Records, we implemented the following method to fetch the User's clinical records but seems the query is failing and the app is getting crashed every time.
We tried the same method with Apple provided sample account and it works fine in the simulator, but it crashes with actual users
Can you please help us to identify the issue?
func getRecordsForCHRType(type: HKClinicalTypeIdentifier, completion:@escaping ([HKClinicalRecord]?) -> Void) {
guard let healthRecordType = HKObjectType.clinicalType(forIdentifier: type) else { return }
let startDate = Calendar.current.date(byAdding: DateComponents(day: -365), to: Date())!
let endDate = Calendar.current.date(byAdding: DateComponents(day: 0), to: Date())!
let predicate = HKQuery.predicateForSamples(withStart: startDate, end: endDate, options: [.strictStartDate])
let sortDescriptor = NSSortDescriptor(key: HKSampleSortIdentifierStartDate, ascending: false)
let healthRecordQuery = HKSampleQuery(sampleType: healthRecordType, predicate: predicate, limit: 0, sortDescriptors: [sortDescriptor]) { (query, samples, error) in
guard let actualSamples = samples else {
completion(nil)
return
}
let healthRecordSamples = actualSamples as? [HKClinicalRecord]
completion(healthRecordSamples)
}
HKHealthStore().execute(healthRecordQuery)
}
Additionally, please help us to understand the following different types of dates(in detail) available in sample Clinical Health Records JSON, and is it possible to apply a filter using any HealthKitQuery on these dates to narrow down the clinical records response?
issued
dateRecorded
recordDate
onset
effective
Any help would be appreciated!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
Being an Account holder, we are unable to find the option on the Apple Developer portal to accept Apple's recent Free Apps agreement updates.
Not sure if it is occring only for us, any help would be appreciated.
Screenshots are attached for reference
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
Developer Program
App Store Connect