BLE Advertising works different in iOS12/13

Hello,

I'm working on a project where the iPhone is in a peripheral role. During some testing I encountered different behaviours between iOS 12 and iOS 13 in following testscenario:
  1. Start advertising

  2. Turn BLE off from control center

  3. Turn BLE on fron control center

Tested with:
iPhone 6+ (iOS 12.2)
iPhone 8 (iOS 12.1)

iPhone X (iOS 13.2.3)


iOS 12:
It seems like the stack automatically restarts the advertising when the BLE is turned on. When there is a BLE state change I check whether the peripheral is advertising. The call isAdvertising() returns false:
Code Block
07-29 11:00:30.111 | BluetoothLink | D(💙) | [99] Peripheral isAdvertising: false


When I then try to call start advertising I receive following error in the delegate:
Code Block
07-29 11:00:30.136 | BluetoothLink | D(💙) | [514] Peripheral manager did start advertising with error: Optional(Error Domain=CBErrorDomain Code=9 "Advertising has already started." UserInfo={NSLocalizedDescription=Advertising has already started.})


iOS 13:
When the BLE is turned back on, the advertising won't be restarted. When I call isAdvertising() it also returns false. Once I start the advertising again it calls the delegate didStartAdvertising without an error.



Are there any changes in the OS which could explain such a behaviour? How should I handle the different behaviour? Is it inteded from the OS to automatically restart the advertising?

Should I just call stopAdvertising everytime before starting the advertisement? Would this approach have negative side effects on the BLE stack?

Thank you for the support.

Regards,
Sebastian P

I am also facing this issue my delegate is called 2 times one is without error i.e error = nil and the next one is

  • some : Error Domain=CBErrorDomain Code=9 "Advertising has already started." UserInfo={NSLocalizedDescription=Advertising has already started.}

What does that mean? is it stopping advertisement please explain.

BLE Advertising works different in iOS12/13
 
 
Q