didDiscoverPeripheral: not working sometimes on background

Happens both on iOS 12 and 13.

I have bluetooth-central correctly added on my Info.plist

I'm specifying a list of service UUIDs

What I am seeing:

- If I interact with our BLE device on the foreground, I can still scan for it on background, even hours and days later, as long as I don't turn off bluetooth or restart the iOS device.

- If I have never interacted with it while the app is open, or If I restart the device, or turn off bluetooth on the device, then when scanning in the background, didDiscoverPeripheral: never gets called, until I open the app, which triggers didDiscoverPeripheral: instantly.

- If I use retrievePeripheralsWithIdentifiers: and iOs can return the object "cached" then I can skip the scan and connect directly, which works perfectly. But sometimes retrievePeripheralsWithIdentifiers: doesn't return the object so I can't always relay on that (And forces the user to interact with our device on the foreground first)

Did you manage to figure this out? I'm having a similar issue, where I can't rely on didDiscoverPeripheral to detect a device in background and trigger a callback that I have.

didDiscoverPeripheral: not working sometimes on background
 
 
Q