Post

Replies

Boosts

Views

Activity

Reply to Proper method to handle error in statisticsUpdateHandler?
I will answer this myself. Solution 1 is to throw fatalError in the case .errorDatabaseInaccessible: statement. This will shutdown the app. But it is not a desirable solution as really forces a crash. Solution 2 is the reprogram the setup to use HKStatisticsCollectionQueryDescriptor and concurrency instead of completion and statisticsUpdateHandler. Wrapping a "for try await" in a repeat and do loop it is possible to catch errors from the try statement and continue the execution in the repeat loop with a continue statement.
1w