CoreBluetooth using objective c++ centralManagerDidUpdateState not being called

More details in my SO post: https://stackoverflow.com/questions/61715002/corebluetooth-delegate-method-never-called-objective-c


So I am trying to make calls to corebluetooth using c++. I am at the point where I have all the implementation details set up in objective c and can call from c++. The problem is that after initializing CBCentralManager, the function centralManagerDidUpdateState is not called.


Expectly, when I call centralManagerDidUpdateState manually the manager's state is unknown. Also one thing to note is most implementation of corebluetooth I've seen are in view controllers, whereas mine is just a simple call to initialize the bluetooth and then terminate the program, so maybe something is wrong there?

Anyone here have experience with this issue?

Thank you!


edit: after digging around, I think corebluetooth is sharing the same thread as the main c++ thread

edi2: okay after some painful debugging and digging I think corebluetooth callbacks depend on running through a main runloop. I implemented a really dirty one to run corebluetooth separate from my testing class thread and now my code works. Will post the solution to stackoverflow when I clean it up.