Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT iOS BLE Issue



  • Anyone have any thoughts on why I would be getting this when using BLE on iOS?

    [qt.bluetooth.ios] can not discover service details in the current state, QLowEnergyController::DiscoveredState is expected
    [CoreBluetooth] XPC connection invalid
    

    Latest iOS, latest XCode, latest Qt/QtCreator...

    Source code in Creator, opening project in XCode and running on device. This used to work a couple months ago on 5.12... but not working on 5.14.

    Ideas?



  • Hi,

    I noticed similar behaviour on both ios and osx, I also upgraded to qt5.14.
    It seems the QLowEnergyController::DiscoveredState comes when QLowEnergyController::discoveryFinished is emitted. My code discovered service details already in serviceDiscovered's handler, which seems caused the described scenario.

    In the slot attached to QLowEnergyController::serviceDiscovered I remember the discovered service uuids in vector of uuis like this
    mServiceUUids.push_back(serviceUUid); // std::vector<QBluetoothUuid> mServiceUUids declared in header file

    then in the slot attached to QLowEnergyController::discoveryFinished loop through the mServiceUUids and do service details discovery.

    Seems to work for me even though it is more a workaround. I need to study what is the proper way to do it.



  • Yeah, this seems to be a workaround, but it works for me well enough to utilize in my project!

    Thanks @VladoV , much appreciated!



  • The issue was resolved by https://codereview.qt-project.org/c/qt/qtconnectivity/+/313077. Thank you for pointing it out. In particular the workaround highlighted the problem.


Log in to reply