Skip to content
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

Unknown error from a native module #153

Open
otto-md opened this issue Mar 13, 2020 · 0 comments
Open

Unknown error from a native module #153

otto-md opened this issue Mar 13, 2020 · 0 comments

Comments

@otto-md
Copy link

otto-md commented Mar 13, 2020

Im getting an error like this if I'm trying to read a value that doesn't exists in the Health app:

console.error: {"code":"E(null)0","message":"Unknown error from a native module","domain":"RCTErrorDomain","userInfo":null,"nativeStackIOS":["0 MyApp 0x0000000104943427 RCTJSErrorFromCodeMessageAndNSError + 135","1 MyApp 0x0000000104943353 RCTJSErrorFromNSError + 275","2 MyApp 0x00000001047a6312 __65-[RCTAppleHealthKit(Methods_Body) body_getLatestWeight:callback:]_block_invoke + 226","3 MyApp 0x00000001047ba577 __87-[RCTAppleHealthKit(Queries) fetchMostRecentQuantitySampleOfType:predicate:completion:]_block_invoke + 375","4 libdispatch.dylib 0x0000000108433dd4 _dispatch_call_block_and_release + 12","5 libdispatch.dylib 0x0000000108434d48 _dispatch_client_callout + 8","6 libdispatch.dylib 0x000000010843b5ef _dispatch_lane_serial_drain + 788","7 libdispatch.dylib 0x000000010843c1b5 _dispatch_lane_invoke + 476","8 libdispatch.dylib 0x0000000108447a4e _dispatch_workloop_worker_thread + 719","9 libsystem_pthread.dylib 0x00007fff524636fc _pthread_wqthread + 290","10 libsystem_pthread.dylib 0x00007fff52462827 start_wqthread + 15"]}

_construct
    construct.js:30:26
Wrapper
    wrapNativeSuper.js:26:23
SyntheticError
    index.bundle?platform=ios&dev=true&minify=false:28788:111
reactConsoleErrorHandler
    ExceptionsManager.js:135:52
Profile
    Profile.tsx:158:6
invokeCallbackAndReturnFlushedQueue
    [native code]:0

My code:

const weightOptions = {
      unit: 'gram' as HealthUnit,
}
AppleHealthKit.getLatestWeight(weightOptions, (error, results) => {
      if (error) {
          console.error('healthkit weight:', error)
      }
      ...
})

I think that returning an empty result object would be better in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant