HealthKit crashes with _validateForCreation
Closed this issue · 2 comments
mordechaim commented
I'm saving sleep records using this library (among other data), but in the XCode organizer it shows up many users are having crashes which I cannot explain. I was not able to reproduce it myself. Can you please point me in the right direction here?
Let me know if you need more information. Thanks!
Date/Time: 2023-02-07 06:29:13.1467 -0600
Launch Time: 2023-02-06 21:42:01.6785 -0600
OS Version: iPhone OS 15.6.1 (19G82)
Release Type: User
Baseband Version: 4.04.02
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 10
Last Exception Backtrace:
0 CoreFoundation 0x1813e1288 __exceptionPreprocess + 220 (NSException.m:200)
1 libobjc.A.dylib 0x19a111744 objc_exception_throw + 60 (objc-exception.mm:565)
2 CoreFoundation 0x181438390 +[NSException raise:format:] + 112 (NSException.m:156)
3 HealthKit 0x18e2494f4 -[HKObject _validateForCreation] + 144 (HKObject.m:127)
4 HealthKit 0x18e249260 +[HKObject _newDataObjectWithMetadata:device:config:] + 276 (HKObject.m:112)
5 HealthKit 0x18e249108 +[HKSample _newSampleWithType:startDate:endDate:device:metadata:config:] + 204 (HKSample.m:42)
6 HealthKit 0x18e24aa9c +[HKCategorySample categorySampleWithType:value:startDate:endDate:device:metadata:] + 296 (HKCategorySample.m:42)
7 AuraTrack 0x10040cfbc @nonobjc HKCategorySample.__allocating_init(type:value:start:end:metadata:) + 48 (<compiler-generated>:0)
8 AuraTrack 0x10040cfbc ReactNativeHealthkit.saveCategorySample(typeIdentifier:value:start:end:metadata:resolve:reject:) + 664 (ReactNativeHealthkit.swift:573)
9 AuraTrack 0x10040d268 @objc ReactNativeHealthkit.saveCategorySample(typeIdentifier:value:start:end:metadata:resolve:reject:) + 368 (<compiler-generated>:0)
10 CoreFoundation 0x181369b24 __invoking___ + 148 (:-1)
11 CoreFoundation 0x181387610 -[NSInvocation invoke] + 468 (NSForwarding.m:3378)
12 CoreFoundation 0x1813be5fc -[NSInvocation invokeWithTarget:] + 80 (NSForwarding.m:3475)
13 AuraTrack 0x1002c0728 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 388 (RCTModuleMethod.mm:584)
14 AuraTrack 0x1002c28a0 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 1190048 (RCTNativeModule.mm:183)
15 AuraTrack 0x1002c2528 invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 1189160 (RCTNativeModule.mm:95)
16 libdispatch.dylib 0x181046e6c _dispatch_call_block_and_release + 32 (init.c:1517)
17 libdispatch.dylib 0x181048a30 _dispatch_client_callout + 20 (object.m:560)
18 libdispatch.dylib 0x181050124 _dispatch_lane_serial_drain + 668 (inline_internal.h:2622)
19 libdispatch.dylib 0x181050c80 _dispatch_lane_invoke + 392 (queue.c:3944)
20 libdispatch.dylib 0x18105b500 _dispatch_workloop_worker_thread + 648 (queue.c:6732)
21 libsystem_pthread.dylib 0x1f25a10bc _pthread_wqthread + 288 (pthread.c:2599)
22 libsystem_pthread.dylib 0x1f25a0e5c start_wqthread + 8 (:-1)
robertherber commented
This is not an error I've seen before. Is it occurring specifically for sleep samples or for other samples as well? Could you post an example that reproduces the issue?
mordechaim commented
I'm not able to reproduce it.
I have a hunch it's somehow related to a bug in React Native itself. I recently updated to 0.72.0-rc.3 and will check how it goes.