DWilliames / idasen-controller-mac

A Mac App to control your Idasen Desk
MIT License
243 stars 19 forks source link

Fix XPC connection invalid error after bluetooth turned off and on #11

Closed szilardhuber closed 2 years ago

szilardhuber commented 2 years ago

Based on what I found on the errror message, this happens when a CBCentralManager instance is disposed. As startScanning is invoked every time the user opens up the popup UI a new instance was created each time. By adding this extra check to only reinitialize when the instance is nil I managed to fix the issue #10.

I'm not sure if there is any other conditions that would need for a reinitialisation of the CBCentralManager but couldn't reproduce any issues with this fix yet.

DWilliames commented 2 years ago

Merges the changes in manually. Accidentally didn't seem to properly get tagged with this PR. But massive thanks for looking into it.