API MISUSE: <CBCentralManager: 0x1014f8150> can only accept this command while in the powered on state
If I call the scanForPeripherals function immediately after calling let centralManager: CentralManager = .live() , I got the error and cannot receive anything.
when i call scanForPeripherals delay some times ,the error is gone and can receive devices
you need to check the state property on the manager before calling methods on it; if it's not .poweredOn then you need to wait for state changes using the state change publisher before calling anything.
This should be a bit more seamless I agree, but I don't have push access to this repo any longer so it may be some time before someone else can merge a PR. in the meantime it should be possible to use the state change publisher to avoid the misuse warnings.