I want to fully control the BLE send timing myself, instead of relying on the iOS system.
When I try to send a large data block using BLE (i.e., splitting it and sending multiple times), I follow Apple’s official guide. However, after the first successful updateValue()
call in my loop, the second call always fails unless I wait for the peripheralManagerIsReady(toUpdateSubscribers:)
callback. This callback timing is managed by the system, so I can’t control exactly when I can send the next packet.
If I send data manually by clicking a button, updateValue()
always returns true—even if I add a long delay (like sleep(10)
) between calls. But in a loop, after the first send, updateValue()
returns false until the thread leaves or the callback occurs. I suspect this is a thread or queue issue blocking subsequent sends.
I also tried using DispatchQueue.global().async {}
in the loop, but the result is the same.
Is there any way to fully control when I call updateValue()
, without waiting for peripheralManagerIsReady()
? Or is this a limitation of iOS BLE?
Thank you!