I am having some trouble with a CBPeripheral that has it's services updated: my physical device has a button that updates the advertising services but my app still reads the old services in the delegate method didDiscoverServices
.
Although when I discover the peripheral in didDiscoverPeripheral
, I can see the services are up-to-date there.
If I run the app again, the old services are still there! It seems the only way to get my app to discover the new services is turning the Bluetooth off and on again. Even uninstalling/reinstalling my app is not enough.
Does iOS cache the services forever? Is there a way to reset/erase the cache?
have you tried this
When you call the scanForPeripheralsWithServices:options:
method of the CBCentralManager class to discover remote peripheral’s that are advertising services, your central device uses its radio to listen for advertising devices until you explicitly tell it to stop
Ref: Best Practices for Interacting with a Remote Peripheral Device
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With