flutter-plugins
flutter-plugins copied to clipboard
[Health version: 3.0.5] crash in SwiftHealthPlugin.getData
Device / Emulator and OS
- Device: [any iOS device]
- OS: [iOS]
Describe the bug
We get numerous crashes for iOS users after migrating to Health package. Although we cannot find a way to reproduce the crash the issue still persists.
To Reproduce
The issue is not reproducible
Expected behavior
User can interact with the package without getting any crashes
Actual behavior
When we call the method to get new data to update the ui, sometimes the users get a following crash:
Crashed: com.apple.HealthKit.HKHealthStore.client.0x283b15c80
0 health 0x102da4edc closure #2 in closure #1 in SwiftHealthPlugin.getData(call:result:) + 168 (
Flutter doctor
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5 20G71 darwin-x64, locale en-DE) • Flutter version 2.2.3 at /Users/igor/Development/flutter • Framework revision f4abaa0735 (4 weeks ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/***/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
✗ Android license status unknown.
Run flutter doctor --android-licenses
to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.5.1, Build version 12E507 • CocoaPods version 1.10.1
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.58.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0
[✓] Connected device (3 available) • iPhone (***) (mobile) • 00008020-001438CE0AFA002E • ios • iOS 14.6 • iPhone 11 (mobile) • BF533310-3BC3-496D-BDB9-D33C2C77D37D • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) • Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107
I've had the same on health 3.1.1+1. It happened in production - I was not able to reproduce it myself.
The HKSampleQuery in question was actually running on a worker thread, but the Flutter plugin channel method was calling on the main thread. According to the official Flutter documentation here, the result is therefore required to be returned on the UI main thread only.
Was this issue ever resolved???
Am getting the same crash multiple times on 3.4.4
This issue is still impacting iOS users - frequency of fatal crashes has picked up in 3.4.4
Hard to reproduce, but when it happens, there's an error here:
also had these a couple of times (4.0.0). Anyone tried to handle this on their own?