Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in OCKHealthKitPassthroughStore #656

Open
drdavec opened this issue May 23, 2022 · 0 comments
Open

Crash in OCKHealthKitPassthroughStore #656

drdavec opened this issue May 23, 2022 · 0 comments

Comments

@drdavec
Copy link
Contributor

drdavec commented May 23, 2022

I am testing my app on several devices via TestFlight and receive frequent crashes from code in OCKHealthKitPassthroughStore. I have a straightforward use of a few CareKit tasks to fetch and display the latest outcome such as step count, exercise minutes, and body weight. The crash never occurs while using the app, but only while idle in the background.

The crash occurs in several locations, but all within the OCKHealthKitPassthroughStore framework code.

For example, at the line "context.performAndWait" shown below.

extension OCKStore {
func fetchHealthKitTasks(query: OCKTaskQuery) throws -> [OCKHealthKitTask] {
var result: Result<[OCKHealthKitTask], Error> = .failure(OCKStoreError.fetchFailed(reason: "Timeout"))
context.performAndWait {

I also receive frequent crashes that appear to be related to use of Calendar when computing schedules, e.g. from last line shown in this snippet.

private func fetchOutcomes(task: OCKHealthKitTask, dateRange: DateInterval,
                           completion: @escaping (Result<[OCKHealthKitOutcome], OCKStoreError>) -> Void) {
    let events = task.schedule.events(from: dateRange.start, to: dateRange.end)

The crash then occurs in this subsequent call to Calendar:
return event.start >= Calendar.current.startOfDay(for: start)

Has anyone else encountered these kinds of crashes? Any suggestions for resolving?

Thank you!
Dave Carlson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant