Post

Replies

Boosts

Views

Activity

HKStatisticsCollectionQueryDescriptor intermittently returns no data for certain date ranges on iOS 27
We are seeing inconsistent results from HKStatisticsCollectionQueryDescriptor on iOS 27. Using the same quantity type, statistics options, anchor date, interval components, and predicate configuration, some date ranges return the expected statistics, while other ranges unexpectedly return empty results or buckets with no quantity. The affected ranges do contain HealthKit samples: HKSampleQueryDescriptor finds samples in the same date range. HKStatisticsQueryDescriptor returns the expected value when run separately for an affected bucket. HKStatisticsCollectionQueryDescriptor returns no quantity for that same bucket. Slightly expanding or shifting the date range may cause the collection query to return data again. A simplified version of the query looks like this: let datePredicate = HKQuery.predicateForSamples( withStart: startDate, end: endDate, options: .strictStartDate ) let descriptor = HKStatisticsCollectionQueryDescriptor( predicate: .quantitySample( type: quantityType, predicate: datePredicate ), options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: DateComponents(day: 1) ) let collection = try await descriptor.result(for: healthStore) collection.enumerateStatistics(from: startDate, to: endDate) { statistics, _ in let quantity = statistics.sumQuantity() print(statistics.startDate, quantity as Any) } Expected behavior Every interval containing matching samples should return the corresponding statistics, regardless of the overall requested date range. Actual behavior Some date ranges produce missing or empty buckets even though matching samples exist and an individual HKStatisticsQueryDescriptor can calculate the expected value. Changing only the date range can make the data appear or disappear. The samples are visible to the app in the affected range, so this does not appear to be explained solely by iOS 27’s Limited History authorization. This behavior was not observed with the same query flow on earlier iOS versions. Is this a known regression in HKStatisticsCollectionQueryDescriptor on iOS 27, or has the expected date-range or predicate behavior changed?
0
0
265
2w
How to replace topLeading menu bar on NavigationSplitView with TabView
I try to replace the default menu bar item. but this code still shows two button items. import SwiftUI @available(watchOS 10.0, *) struct TabViewPreview<Content: View>: View { let content: Content init(@ViewBuilder content: () -> Content) { self.content = content() } @State private var selection: String? = "preview" var body: some View { NavigationSplitView { List(selection: $selection) { Text("preview").tag("preview") } } detail: { TabView { content } .toolbar(content: { ToolbarItem(placement: .topBarLeading) { Button(action: {}) { Image(systemName: "shared.with.you") } } }) .tabViewStyle(.verticalPage) } } } @available(watchOS 10.0, *) #Preview { TabViewPreview { Text("A") } }
0
0
514
Sep ’23
Resume long lived operation failed with error CKDatabaseOperations must be submitted to a CKDatabase
Hey, there There's a crash on Apple's document example here https://developer.apple.com/documentation/cloudkit/ckoperation And if we replacing self.container.add (modifyOp) with self.database.add (modifyOp)  it seem will not sync data from iCloud any more. More info: https://developer.apple.com/forums/thread/685863
0
0
701
Jun ’22
HKStatisticsCollectionQueryDescriptor intermittently returns no data for certain date ranges on iOS 27
We are seeing inconsistent results from HKStatisticsCollectionQueryDescriptor on iOS 27. Using the same quantity type, statistics options, anchor date, interval components, and predicate configuration, some date ranges return the expected statistics, while other ranges unexpectedly return empty results or buckets with no quantity. The affected ranges do contain HealthKit samples: HKSampleQueryDescriptor finds samples in the same date range. HKStatisticsQueryDescriptor returns the expected value when run separately for an affected bucket. HKStatisticsCollectionQueryDescriptor returns no quantity for that same bucket. Slightly expanding or shifting the date range may cause the collection query to return data again. A simplified version of the query looks like this: let datePredicate = HKQuery.predicateForSamples( withStart: startDate, end: endDate, options: .strictStartDate ) let descriptor = HKStatisticsCollectionQueryDescriptor( predicate: .quantitySample( type: quantityType, predicate: datePredicate ), options: .cumulativeSum, anchorDate: anchorDate, intervalComponents: DateComponents(day: 1) ) let collection = try await descriptor.result(for: healthStore) collection.enumerateStatistics(from: startDate, to: endDate) { statistics, _ in let quantity = statistics.sumQuantity() print(statistics.startDate, quantity as Any) } Expected behavior Every interval containing matching samples should return the corresponding statistics, regardless of the overall requested date range. Actual behavior Some date ranges produce missing or empty buckets even though matching samples exist and an individual HKStatisticsQueryDescriptor can calculate the expected value. Changing only the date range can make the data appear or disappear. The samples are visible to the app in the affected range, so this does not appear to be explained solely by iOS 27’s Limited History authorization. This behavior was not observed with the same query flow on earlier iOS versions. Is this a known regression in HKStatisticsCollectionQueryDescriptor on iOS 27, or has the expected date-range or predicate behavior changed?
Replies
0
Boosts
0
Views
265
Activity
2w
How to clear Complications caches after delete watch app
Hi guys, We have received several reports from our users: after deleting the watch app, the complications still remain. It seems system cache the config and forget to remove after deleting the app. (Our app is useing WidgetKit as complications)
Replies
0
Boosts
0
Views
719
Activity
Sep ’23
How to replace topLeading menu bar on NavigationSplitView with TabView
I try to replace the default menu bar item. but this code still shows two button items. import SwiftUI @available(watchOS 10.0, *) struct TabViewPreview<Content: View>: View { let content: Content init(@ViewBuilder content: () -> Content) { self.content = content() } @State private var selection: String? = "preview" var body: some View { NavigationSplitView { List(selection: $selection) { Text("preview").tag("preview") } } detail: { TabView { content } .toolbar(content: { ToolbarItem(placement: .topBarLeading) { Button(action: {}) { Image(systemName: "shared.with.you") } } }) .tabViewStyle(.verticalPage) } } } @available(watchOS 10.0, *) #Preview { TabViewPreview { Text("A") } }
Replies
0
Boosts
0
Views
514
Activity
Sep ’23
Resume long lived operation failed with error CKDatabaseOperations must be submitted to a CKDatabase
Hey, there There's a crash on Apple's document example here https://developer.apple.com/documentation/cloudkit/ckoperation And if we replacing self.container.add (modifyOp) with self.database.add (modifyOp)  it seem will not sync data from iCloud any more. More info: https://developer.apple.com/forums/thread/685863
Replies
0
Boosts
0
Views
701
Activity
Jun ’22