question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[iOS][0.9.0] Device.onDisconnected() emits nulls

See original GitHub issue

When running the below code snippet the error is a null instead of BleError. It is observed on iOS only.

  device.onDisconnected((error) => {
    console.log(typeof error); // 'object'
    console.log(error === null); // 'true'
  });

On Android the library seems to work just fine.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
suarkcommented, Aug 27, 2019

@cernadasjuan I basically had to work around the issue. I kept track of when my user purposefully tried to disconnect.

If my user tries to disconnect, and then we do disconnect, then I know it was on purpose.

If my user didn’t try to disconnect, and then we disconnect, then I know it was probably an error.

That seems to be reliable but I definitely would have preferred to rely on the API handling the situation the same way for iOS and android.

0reactions
suarkcommented, Aug 29, 2019

@cernadasjuan that’s awesome. Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[iOS][0.9.0] Device.onDisconnected() emits nulls #265 - GitHub
onDisconnected callback means that the connection was lost. The error is guaranteed to be set to null if you called bleManager.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found