-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Hard Crash when addQuantity is used. #57
Comments
@kvs-coder I was able to fix this in this repo. But since health_kit_reporter/ios/Classes/Extensions+SwiftHealthKitReporterPlugin.swift Lines 1299 to 1335 in 5954841
Fix private func addQuantity(
reporter: HealthKitReporter,
arguments: [String: Any],
result: @escaping FlutterResult
) {
guard
let quantity = arguments["quantities"] as? [[String: Any]],
let workout = arguments["workout"] as? [String: Any]
else {
throwParsingArgumentsError(result: result, arguments: arguments)
return
}
let device = arguments["device"] as? [String: Any]
do {
let w = try Workout.make(from: workout)
reporter.writer.addQuantitiy(
try quantity.map {
let q = try Quantity.make(from: $0)
return q.copyWith(
startTimestamp: q.startTimestamp.secondsSince1970,
endTimestamp: q.endTimestamp.secondsSince1970
)
},
from: device != nil
? try Device.make(from: device!)
: nil,
to: w.copyWith(
startTimestamp: w.startTimestamp.secondsSince1970,
endTimestamp: w.endTimestamp.secondsSince1970,
workoutEvents: w.workoutEvents.map { event in
event.copyWith(
startTimestamp: event.startTimestamp.secondsSince1970,
endTimestamp: event.endTimestamp.secondsSince1970
)
}
)
) { (success, error) in
guard error == nil else {
result(
FlutterError(
code: "AddQuantity",
message: "Error in addQuantity",
details: error.debugDescription
)
)
return
}
result(success)
}
} catch {
throwPlatformError(result: result, error: error)
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Using the
await HealthKitReporter.addQuantity
function causes the app to hard crash.To Reproduce
Error
Swift Equivalent
The text was updated successfully, but these errors were encountered: