After the macOS Sequoia update, my app seems to have an issue with Bluetooth communication between macOS and iOS that uses CoreBluetooth for Central-Peripheral communication.
Setup:
- The iPhone (in my case: iPhone 14 Pro with iOS 18.0 (22A3354)) acts as the Central, and the Mac (in my case: 14" MacBook Pro 2023 with macOS 15.0 (24A335)) as the Peripheral.
- I’ve implemented a mechanism where the Central (iPhone) sends a message to the Peripheral (Mac) every 15 seconds to keep the connection alive (Because it needs to wait for notify characteristic updates).
- I never noticed this kind of issue before, but with macOS Sequoia I get it permanently.
Issue:
The connection drops unexpectedly after a period of time (sometimes 20 seconds, sometimes a few minutes) with CBErrorDomain - code 6: The connection has timed out unexpectedly.
Sample Code:
Peripheral (Mac):
Central (iPhone):
Reproduce:
I attached sample code including the Central-Sample (for iPhone) and Peripheral-Sample (for Mac).
- Just run the Peripheral-Sample (after granting Bluetooth permissions).
- Then run the Central-Sample and select the Mac device in the list
- After selecting it should connect, discover the service & characteristic and should start writing messages to it.
- After some time the func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: (any Error)?) {should get called with timed out unexpectedly error.
Could anyone please look into this issue and advise on whether there’s a known bug or any workaround? Any guidance would be greatly appreciated, as this impacts the stability of Bluetooth communication between the devices.
Thanks in advance.
Logs:
I also ran the console.app during this issue which got these errors (if this is helpful):