Hey, I'm experiencing similar issues with inconsistencies when includesPastActivity is false, the only (simple) solution I came up with was a version check, since then it works for above iOS 17.4 at least
func activityEvent(_ key: String, threshold: DateComponents? = nil) -> DeviceActivityEvent {
loadSelection(for: key)
let applications = selectionToRestrict
if #available(iOS 17.4, *) {
return DeviceActivityEvent(
applications: applications.applicationTokens,
categories: applications.categoryTokens,
webDomains: applications.webDomainTokens,
threshold: threshold ?? DateComponents(minute: 0),
includesPastActivity: true
)
} else {
return DeviceActivityEvent(
applications: applications.applicationTokens,
categories: applications.categoryTokens,
webDomains: applications.webDomainTokens,
threshold: threshold ?? DateComponents(minute: 0)
)
}
}
If you don't want to set it to true, I unfortunately cannot help you. This seems to be one of many issues with DeviceActivity.