Closed aleksanderaleksic closed 6 years ago
@aleksanderaleksic Thanks for report.
I've tried to reproduce this behaviour but without success.
From the above error it means that CBPeripheral
doesn't have delegate set or peripheral:didDiscoverServices:
in delegate is not implemented.
Are you changing CBPeripheral
delegate? or maybe are you using some other bluetooth library that could do that?
Mhm, I am actually using another Library that I provide the CBPeripheral to. But shouldn't the delegate get set again when I connect to it? If not, how can I set it again?
I think i see ut now. If i call the attach()
method om the peripheral object, that will "reset" the peripheral? Right?
Cannot test it now, i where just looking through your source code.
It solved it!
Thanks for the help!
Hello @aleksanderaleksic
Could you share how did you solve the problem?
@aleksanderaleksic yes, attach()
method is for re attaching RxBluetoothKit delegates to CBPeripheral
. Great that you solved it :)
@dariuszseweryn I solved it by calling peripheral.attach()
on the peripheral object.
Like this (but this is a very simple example):
manager.scanForPeripherals(withServices: [SOME UUIDS])
.flatMap{ $0.peripheral.establishConnection() }
.flatMap{ $0.attach() }
So i do this everytime i connect to a peripheral, just to be sure its set.
Describe the bug I have a Peripheral that I have been connected to and now try to connect again after a disconnect. But when I reconnect and try to discoverServices, I get this error from CoreBluetooth:
[CoreBluetooth] API MISUSE: Discovering services for peripheral <CBPeripheral: 0x1c811c320, identifier = F33ABC8C-4A72-5FCB-C6D0-91708AB10A3B, name = Airthings Node, state = connected> while delegate is either nil or does not implement peripheral:didDiscoverServices:
To Reproduce Steps to reproduce the behavior:
Expected behavior I expect it to scan and return the services.
Environment: