skip to Main Content

The crash happens with a Flutter app on <1% of devices (of all versions and models) when requesting the authorization for writing to Apple Health via a package (health_kit_reporter and HealthKitReporter).

Last Exception Backtrace:
0   CoreFoundation                  0x1add0d9d4 __exceptionPreprocess + 216 (NSException.m:199)
1   libobjc.A.dylib                 0x1c16beb54 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                  0x1adc1c4fc +[NSException raise:format:arguments:] + 96 (NSException.m:146)
3   Foundation                      0x1aef14878 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 128 (NSException.m:231)
4   Flutter                         0x10585c82c -[FlutterStandardMethodCodec encodeErrorEnvelope:] + 196 (FlutterStandardCodec.mm:110)
5   Flutter                         0x1058597c8 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke_2 + 136 (FlutterChannels.mm:0)
6   health_kit_reporter             0x105152cbc thunk for @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () + 92 (<compiler-generated>:0)
7   health_kit_reporter             0x105161c2c closure #1 in SwiftHealthKitReporterPlugin.requestAuthorization(reporter:arguments:result:) + 320
8   health_kit_reporter             0x10516ca14 partial apply for closure #1 in SwiftHealthKitReporterPlugin.requestAuthorization(reporter:arguments:result:) + 72 (<compiler-generated>:0)
9   HealthKitReporter               0x104dd875c thunk for @escaping @callee_guaranteed (@unowned Bool, @guaranteed Error?) -> () + 56 (<compiler-generated>:0)
10  HealthKit                       0x1b7f9d21c __84-[HKHealthStore requestAuthorizationToShareTypes:readTypes:shouldPrompt:completion:]_block_invoke + 368 (HKHealthStore.m:688)
11  libdispatch.dylib               0x1ad945298 _dispatch_call_block_and_release + 24 (init.c:1454)
12  libdispatch.dylib               0x1ad946280 _dispatch_client_callout + 16 (object.m:559)
13  libdispatch.dylib               0x1ad8eedcc _dispatch_lane_serial_drain$VARIANT$mp + 612 (inline_internal.h:2548)
14  libdispatch.dylib               0x1ad8ef8d8 _dispatch_lane_invoke$VARIANT$mp + 472 (queue.c:3862)
15  libdispatch.dylib               0x1ad8f9338 _dispatch_workloop_worker_thread + 712 (queue.c:6601)
16  libsystem_pthread.dylib         0x1f43aa5a4 _pthread_wqthread + 272 (pthread.c:2206)
17  libsystem_pthread.dylib         0x1f43ad874 start_wqthread + 8

enter image description here

Is there any information on why the crash happened?
Or is there a trick to reproduce errors during debugging with Xcode?

2

Answers


  1. Chosen as BEST ANSWER

    This error was fixed with the changes here: https://github.com/VictorKachalov/health_kit_reporter/pull/25/files


  2. I stumbled across this error in my app. I have yet to verify this, but it looks like the issue is caused by call in encodeErrorEnvelope which tries to write error detail, and if such error detail is not encodable, it crashes the app.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search