Closed florianbuerger closed 1 year ago
Hello,
First of all, sorry for the delay. I missed your post.
You have a valid point. I will update the library. If the device is already connected, the connection should happen even if the device is no longer advertising. Expect 0.16.1 soon.
The version is now tagged. I'm releasing 0.16.1 on CocoaPods now. Please, give it a spin. Your issue should now be fixed. Additionally, the fix also includes fast connection to already connected devices.
Thank you 🙌
I am not too familiar with the internal workings, so maybe I am missing something: We upgraded to the recent version, but all our tests are breaking now because a mock peripheral that is already connected by the system never connects.
Looking through the diff, it seems the manager now only set
mock.state = .connecting
. The actual connection is only triggered instatic CBMCentralManagerMock.peripheralBecameAvailable(_:)
which is called when a peripheral is advertising. Previously, the connection was established during theCBMCentralManagerMock.connect(_:options:)
.Our peripheral does connect to iOS in the background without any involvement from our app. The peripheral stops advertising when connected. Our mock looks like this
If I revert the change in
CBMCentralManagerMock:728
everything works again.
Is this an oversight? Or am I missing something? Is there a new way to simulate this use case?